set binary mode for temporary file to fix Windows bug