fix the functionality for preventing a button from closing the modal