Remove the last entry once on EOF instead of removing whatever is at the end of the list multiple times.