Using custom Xlib error handler to detect if opengl context is valid.  Everything seems to be fine, except the glswapbuffer function when the window is closed, because the window and display variables are unloaded(FIX BY USING POINTERS AND CHECK VALUES)