Terminating if error in window criation