Close the file handle after creating a temp file