Fix bug that removed newlines at end of file