Make sure uploaded files are closed even if error is raised