cleaning code some, changed to atexit for glfwTerminate, exit for errors (return 0 at end).