f_handle, f_path = tempfile.mkstemp()
with os.fdopen(f_handle, 'w') as f:
    f.write(res)
try:
    some_function(f_path)
finally:
    os.unlink(f_path)
python: need to close file from mkstemp if I use fdopen?