Actually you should use “wb” everywhere. It’s extra important on Windows. The “b” stands for “binary”. When you leave that off any byte that’s an ASCII 13 or ASCII 10 gets converted to the Windows/DOS CRLF line endings. That is it on Windows text files are assumed to have a carriage return character (CR or ASCII 13 or sometimes referred to as \r) followed by a line feed character (LF or ASCII 13 or sometimes referred to as \n). Unix based file systems like macOS, iOS and Android use a single line feed character for their end of line character. In theory replacing a 10 with a 10 is a no-harm operation, but to be safe, if you always write binary files with the “b” add on, it will always be binary safe and you only have to code it one way.
Bit of history, the old Mac OS7 (and maybe OS9) used a single carriage return (13) character. This made for a real challenge moving text files between OS7, Windows/DOS and Unix.
Rob