Fix modal click-to-close logic.