/Engine/Source/Editor/UnrealEd/Classes/Editor/EditorEngine.h
Request that the current PIE/SIE session should end. This should be used to end the game if its not safe to directly call EndPlayMap in your stack frame
void RequestEndPlayMap()