WINDOWS - added more error handling to win_window.c