how do i modify the last line of a file?,f.close()