writer_cleanup