Handle closing an open dropdown when clicking outside of it.