Ensure that tempfiles are always closed