### Godot version

v4.2.beta2.official [f8818f85e]

### System information

Windows 10, 64bit

### Issue description

Some times can't add node in visualshader editor

### Steps to reproduce

1. Open a VisualShader file for edit.
2. Click the `Add Node...` button, it will popup menu, it is OK.
3. Direct close the menu.
4. Clikd the `Add Node...` again, the menu can't popup.
![GIF](https://github.com/godotengine/godot/assets/35988767/1326c63e-3e05-4423-9ec7-7ce305b3f4f5)

### Minimal reproduction project

/
edit_type_sky->select(0);
	edit_type_sky->connect("item_selected", callable_mp(this, &VisualShaderEditor::_mode_selected));
	edit_type_fog = memnew(OptionButton);
	edit_type_fog->add_item(TTR("Fog"));
	edit_type_fog->select(0);
	edit_type_fog->connect("item_selected", callable_mp(this, &VisualShaderEditor::_mode_selected));
	edit_type = edit_type_standard;
	graph->get_menu_hbox()->add_child(custom_mode_box);
	graph->get_menu_hbox()->move_child(custom_mode_box, 0);
	graph->get_menu_hbox()->add_child(edit_type_standard);
	graph->get_menu_hbox()->move_child(edit_type_standard, 0);
	graph->get_menu_hbox()->add_child(edit_type_particles);
	graph->get_menu_hbox()->move_child(edit_type_particles, 0);
	graph->get_menu_hbox()->add_child(edit_type_sky);
	graph->get_menu_hbox()->move_child(edit_type_sky, 0);
	graph->get_menu_hbox()->add_child(edit_type_fog);
	graph->get_menu_hbox()->move_child(edit_type_fog, 0);
	add_node = memnew(Button);
	add_node->set_flat(true);
	add_node->set_text(TTR("Add Node..."));
	graph->get_menu_hbox()->add_child(add_node);
	graph->get_menu_hbox()->move_child(add_node, 0);
	add_node->connect("pressed", callable_mp(this, &VisualShaderEditor::_show_members_dialog).bind(false, VisualShaderNode::PORT_TYPE_MAX, VisualShaderNode::PORT_TYPE_MAX));
	varying_button = memnew(MenuButton);
	varying_button->set_text(TTR("Manage Varyings"));
	varying_button->set_switch_on_hover(true);
	graph->get_menu_hbox()->add_child(varying_button);
	PopupMenu *varying_menu = varying_button->get_popup();
	varying_menu->add_item(TTR("Add Varying"), int(VaryingMenuOptions::ADD));
	varying_menu->add_item(TTR("Remove Varying"), int(VaryingMenuOptions::REMOVE));