Properly close the modal