Implemented graceful closing of the GLFW window, along with emulation.