Perform shutdown behaviours on terminate

Shutdown notifications don't work for headless processes like us (LSUIElement) :-(