[utils/_windows_write_string] Be defensive about fileno (Fixes #2820)