Added an AfterClose event

Allows for extra programatic control over the way the popup behaves.