We would need way more information to help you. The first thing
you should do is figure out what part of the file is being written differently. Check the versions of all related applications and libraries and check to see if there is incompatibility. Check the extension and file type of the downloaded file to make sure it is the same between the two environments.