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