Fix encoding to file when using GPU processing.