Remove the need for EOF assertions by ensuring the buffer ends with newline