Fix newline handling.

Python 3 has a newline argument to open, which by default does implicit
conversions from anything and to platform specific newlines. Use this
new argument and use \n in strings.