Break if xcb_connection has error in record event handling
xcb_poll_for_reply may have both error and reply to null if connection has error. This is the real cause of the dead loop during shutdown.