### Godot version

Godot Engine v4.0.beta9.mono.official.e780dc332

### System information

Vulkan API 1.3.205 - Using Vulkan Device #0: NVIDIA - NVIDIA GeForce RTX 3070 Ti Laptop GPU

### Issue description

When using a sampler2d[] in a shader, the game window will not close and the task must be killed/forced closed.  Debugging shows that the code is frozen on this method: godotsharp_internal_refcounted_disposed;




### Steps to reproduce

In the attached project, there is a shader "foliageShader.gdshader" that contains a sampler2d[].  If you run the project as is and then just click X to close the window, you should see the described behavior.  Changing the shader to a single sampler2d should cause the issue to go away.

### Minimal reproduction project

[Repro (2).zip](https://github.com/godotengine/godot/files/10298745/Repro.2.zip)

actions.renames["ATTRACTOR_FORCE"] = "attractor_force";
		actions.render_mode_defines["disable_force"] = "#define DISABLE_FORCE\n";
		actions.render_mode_defines["disable_velocity"] = "#define DISABLE_VELOCITY\n";
		actions.render_mode_defines["keep_data"] = "#define ENABLE_KEEP_DATA\n";
		actions.render_mode_defines["collision_use_scale"] = "#define USE_COLLISION_SCALE\n";
		actions.default_filter = ShaderLanguage::FILTER_LINEAR_MIPMAP;
		actions.default_repeat = ShaderLanguage::REPEAT_ENABLE;
		shaders.compiler_particles.initialize(actions);
	}
	{
		
		ShaderCompiler::DefaultIdentifierActions actions;
		actions.renames["COLOR"] = "color";
		actions.renames["ALPHA"] = "alpha";
		actions.renames["EYEDIR"] = "cube_normal";
		actions.renames["POSITION"] = "position";
		actions.renames["SKY_COORDS"] = "panorama_coords";
		actions.renames["SCREEN_UV"] = "uv";
		actions.renames["TIME"] = "time";
		actions.renames["FRAGCOORD"] = "gl_FragCoord";
		actions.renames["PI"] = _MKSTR(Math_PI);
		actions.renames["TAU"] = _MKSTR(Math_TAU);
		actions.renames["E"] = _MKSTR(Math_E);
		actions.renames["HALF_RES_COLOR"] = "half_res_color";
		actions.renames["QUARTER_RES_COLOR"] = "quarter_res_color";
		actions.renames["RADIANCE"] = "radiance";
		actions.renames["FOG"] = "custom_fog";
		actions.renames["LIGHT0_ENABLED"] = "directional_lights.data[0].enabled";
		actions.renames["LIGHT0_DIRECTION"] = "directional_lights.data[0].direction_energy.xyz";
		actions.renames["LIGHT0_ENERGY"] = "directional_lights.data[0].direction_energy.w";