create_temporary_file(): Fix use-after-free