FIX: Add check for if element doesnt exist on ensureDropClosed (PR #13256)

This commit adds a check to make sure the element exists before trying to set the expanded property to false. I also refactor the next and window.onClick to make a call to this.ensureDropClosed() instead of duplicating the functionality internally.

GitHub