There are many possibilities.
If you're using TestStand's own Message Popup step, it knows how to end itself when the Execution that created it ends. That's how Terminate Execution is able to work even when a popup is displayed. So, to take advantage of that, you can display the popup in a sub-sequence that you call with the "Run Sequence in a New Execution" option. Configure it to use no process model for the call, and save a reference to the execution. The "Initially Hidden" and "Close Window when Done" options will reduce clutter in your operator interface. Kill the popup by terminating it's Execution with a TestStand API call using the ActiveX adapter. I've attached an example sequence showing the technique.
If you're using your own dialo
g for the popup, you can use the Termination Monitor methods of the TestStand API, or poll for the end of the execution using the GetStates method (both methods of the Execution interface). This is more complicated, but you can refer to the source for TestStand's Message Popup step to see how they do it. That source is in \Components\ni\StepTypes\MsgBox\msgbox.c, and involves the TS_CancelDialogIfExecutionStops call.
Finally, I guess you could code the dialog to poll a TestStand variable from a thread. Ugly as sin, but it would probably work.