write data to a file in python,f.close()