Global click handler to close popover when clicking outside popover