remove file closing because writing is in a block