fn close_tempfile_and_log_error(file: NamedTempFile)