This PR adds ugly crutches to avoid {i,o}fstream errors when cross-compiling for Windows in the Guix environment.
I'm not happy with this solution, but it ~works~.
Guix builds:
$ find guix-build-$(git rev-parse --short=12 HEAD)/output/ -type f -print0 | env LC_ALL=C sort -z | xargs -r0 sha256sum
157830ddd10f50a21ebbb7d54708c46b37b0a19739d09b2ae2d75ff8bc62b5ee guix-build-fe054cf4abbd/output/dist-archive/bitcoin-fe054cf4abbd.tar.gz
291ffabfdbca6880c4ac83589a23c90df4d481d8fd5d068ecaf61f772e644d69 guix-build-fe054cf4abbd/output/x86_64-w64-mingw32/SHA256SUMS.part
93544c07d29126500fda993b6892013ea5fc84a0ee9aaf02e04c434f1b4d2540 guix-build-fe054cf4abbd/output/x86_64-w64-mingw32/bitcoin-fe054cf4abbd-win-unsigned.tar.gz
b6502582afea382950c2b3382058bdf504d8c82d9f4b4ac3da3e6c68c6d19aae guix-build-fe054cf4abbd/output/x86_64-w64-mingw32/bitcoin-fe054cf4abbd-win64-debug.zip
f03f7049d032a153d32326726c29bf3119da461dac8c720c1548d497d7037622 guix-build-fe054cf4abbd/output/x86_64-w64-mingw32/bitcoin-fe054cf4abbd-win64-setup-unsigned.exe
3540d07ce1e6106dce59fe401f7fb33211885b05d3a607268580a5de88f71ae3 guix-build-fe054cf4abbd/output/x86_64-w64-mingw32/bitcoin-fe054cf4abbd-win64.zip
Fixes bitcoin/bitcoin#24055.