Wrapped main loop in a try/except statement to catch any keyboard interupt and exit.