python: how to create a file .txt and record information in it,file.close()