Fix writing of binary file

Strabgely enough this dowsn't seem to be an issue on Linux
whule on Windows without this patch downloaded sources
are unreadable.