quoting the docs: "mkstemp() returns a tuple containing an OS-level handle to an open file (as would be returned by os.open()) and the absolute pathname of that file, in that order." So your ```file_descriptor``` is a file object, and you should use its ```close()``` method.