Ensure that we get callback before closing the popup