catch mouseup event when closing popups