Tutorial 1 fix, adds window check

Without check, the opengl context would not exit and the program would have to be forcibly shut down ("kill -9" style)