Ensure debug logging is unbuffered on Windows

Debug logs should appear immediately.  On Windows line buffering is not supported so we fall back to unbuffered file I/O.  This way the log files can be inspected while the program is running and they are up-to-date.