Added validation for close button and centered popup confirmation