### 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

/
varying_menu->connect("id_pressed", callable_mp(this, &VisualShaderEditor::_varying_menu_id_pressed));
	preview_shader = memnew(Button);
	preview_shader->set_theme_type_variation("FlatButton");
	preview_shader->set_toggle_mode(true);
	preview_shader->set_tooltip_text(TTR("Show generated shader code."));
	graph->get_menu_hbox()->add_child(preview_shader);
	preview_shader->connect("pressed", callable_mp(this, &VisualShaderEditor::_show_preview_text));
	
	
	
	preview_window = memnew(Window);
	preview_window->set_title(TTR("Generated Shader Code"));
	preview_window->set_visible(preview_showed);
	preview_window->connect("close_requested", callable_mp(this, &VisualShaderEditor::_preview_close_requested));
	preview_window->connect("size_changed", callable_mp(this, &VisualShaderEditor::_preview_size_changed));
	add_child(preview_window);
	preview_vbox = memnew(VBoxContainer);
	preview_window->add_child(preview_vbox);
	preview_vbox->add_theme_constant_override("separation", 0);
	preview_text = memnew(CodeEdit);
	syntax_highlighter.instantiate();
	preview_vbox->add_child(preview_text);
	preview_text->set_v_size_flags(Control::SIZE_EXPAND_FILL);
	preview_text->set_syntax_highlighter(syntax_highlighter);
	preview_text->set_draw_line_numbers(true);
	preview_text->set_editable(false);
	error_panel = memnew(PanelContainer);
	preview_vbox->add_child(error_panel);
	error_panel->set_visible(false);
	error_label = memnew(Label);