Add mechanism to allow exit using window close etc.
This mechanism saves config (key-mappings, nvram, etc) as the app exits.