/Engine/Source/Runtime/Slate/Public/Framework/Application/SlateApplication.h
Assign a delegate to be called when this application is requesting an exit (e.g. when the last window is closed).
void SetExitRequestedHandler ( const FSimpleDelegate & OnExitRequestedHandler )