Inside the component scripting for the Pop Up window, you can use the internalFrameClosing or internalFrameClosed event handlers to set a tag value.
You can access this by selecting the window (not the root container, the actual window) and right clicking and selecting scripting (you can also use ctrl+j to access this).