fix OpenGL error 0x506 on mac when closing program.
fix fullscreen function for mac.