Fix an error that occurs when closing the dropdown menu.