WxNotebook closing

I have a notebook with several tabs running various scripts.
How do I communicate to the tabs the fact that a user has clicked on “X” to close the notebook?
The tabs may have un-saved data that needs handling.