changed addLineToFile() to add a newline if the file does not end with o...

...ne. fixes #372