fix: delay collector disposal until all file writing has completed.