Corrected to binary mode file write.