Added support to exit application when it loses focus. Controlled by config value ExitOnLoseFocus (1 to exit, 0 to remain open).