delete final line in file with python,file.close()