Closing only open dropdowns

Instead of iterating every dropdown, we're closing only the open ones.
Merge pull request #5895 from eljojo/patch-1

Dropdown: Closing only open dropdowns