Use mode 'w' instead of 'wb' througout the code

File writes now use the platform's default line endings instead of always
writing ``\n`` unix style line endings. (Technically, we write using ``w``
instead of ``wb`` mode).