Add hacks to make wlc exit cleanly, until better resource management is
added.
Fix static analyze warnings.