Add a signal handler so we can nicely run module unload code on shutdown

I go ahead and run the main_loop always in a child thread, because it
makes it more like the old mavproxy behavior.  If a daemon I check every
100ms if we have been asked to quit.