Merge close modal function into onClose