Cocoa: Application.Terminate needs to post an event after NSApplication.stop()
Application.Terminate will not actually process until a new event comes in. See: https://stackoverflow.com/a/48064752
This fixes it for me.
Application.Terminate;
NSApplication.sharedApplication.postEvent_AtStart(
nsEvent.otherEventWithType_location_modifierFlags_timestamp_windowNumber_context_subtype_data1_data2(NSApplicationDefined,
GetNSPoint(0,0),
0,
NSTimeIntervalSince1970,
0,
nil,
0, 0, 0),
True
);
Edited by Olly