Fixed 'open' to write binary data in Windows too