Added custom close events for dialog boxes.