opening output file in binary mode to be windows compliant - fixed #5