Open XML output in binary mode

Fixes encoding problem on Windows.

Suggested by Bastian Eicher.