Added more events into event loop switch statement and fixed XIO fatal error when using window manager to close window.