Persist the global memento to disk before the runtime tears down. Creates the parent directory if missing.