Gently quit

If erlang quits (on mac at least since it runs "main" thread)
before the ports is closed, erlang exit and wx cleanup
both deletes memory from two threads which causes double deletes
and crashes when closing wings.

First close the window, so the driver do not need do so much
cleaning before exiting, since the delete/destory is
async do init:stop() and wait for threads to exit.