Fixed 'open' to write binary data in Windows too

No output produced in Windows. Needed to force 'open' the output file in binary mode.