Fix for Windows line breaks

Output files need to be set with 'wb' mode for Windows line feeds to be set correctly. 'wb' is also safe for Linux.