closing the stream in metadataPersistentManager flush method