Close multiwriters. Move other file close statements above error blocks.