Wrap the main loop in a try: except: to catch CTRL-C