Dismiss modals by clicking elsewhere on the document