Added a hack to fix crash on exit.

Domoticz is dependent upon the order of destruction of global objects,
namely, _log and m_mainworker (there can be other dependencies, too,
but let's at least fix this one). Unfortunately this order is
pretty much random.