Fix endfile with newline