fixed issue with modals not closing propertly