I understand your problem. Even an InternalFrameListener doesn't get any events when the tab is changed. Basically the UI considers the tabbed pane as one big container, always displayed and active.
What I ended up doing was making all my JInternalFrame objects globally accessable (I made them static) so when the stateChanged event occured, I could examine them and do any needed cleanup on them. In your case, remove all popups.