Changed write mode to explict binary for compatability with windows systems, Thanks Sebastien