Grasshopper Player - Script Complete Event?

Is there an event which is passed by a script that is running through the Grasshopper player, which lets Rhino (or Revit, when running as Rhino Inside) know that the solution has completed and to close the script?

I am working on some scripts that use Human UI, but the GHplayer thinks that those scripts are finished running before they actually are. I was thinking of building a component to intercept the event or somehow otherwise signal that the script should continue running until the user has made all their selections.

I’ve checked the developer documentation but it seems a little sparse when it comes to the Grasshopper Player, so any insight from the development team would be a huge help. I am comfortable writing either a custom c# component or using a C#/ python component (whatever is needed).

I suspect the answer may be some combination like…
If running as command (link) && window.HasChildren (link) then… something.

This is semi-related to this post: