You cannot. Pausing a component event script freezes the whole GUI. There is no equivalent to VB's "doEvents" statement.
What you can do is stick a callable (function object) into a client property of the pop-up and have the popup look for it and run it on close. See this related topic: