Ensure file is written in binary mode.