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

bv[3].x = m2[12];
			bv[3].y = m2[13];
			bv[3].z = m2[14];
			bv[3].w = m2[15];
		} break;
		case RS::GLOBAL_VAR_TYPE_TRANSFORM_2D: {
			GlobalShaderUniforms::Value *bv = &global_shader_uniforms.buffer_values[p_index];
			Transform2D v = p_value;
			bv[0].x = v.columns[0][0];
			bv[0].y = v.columns[0][1];
			bv[0].z = 0;
			bv[0].w = 0;
			bv[1].x = v.columns[1][0];
			bv[1].y = v.columns[1][1];
			bv[1].z = 0;
			bv[1].w = 0;
			bv[2].x = v.columns[2][0];
			bv[2].y = v.columns[2][1];
			bv[2].z = 1;
			bv[2].w = 0;
		} break;
		case RS::GLOBAL_VAR_TYPE_TRANSFORM: {
			GlobalShaderUniforms::Value *bv = &global_shader_uniforms.buffer_values[p_index];
			Transform3D v = p_value;
			bv[0].x = v.basis.rows[0][0];
			bv[0].y = v.basis.rows[1][0];
			bv[0].z = v.basis.rows[2][0];
			bv[0].w = 0;
			bv[1].x = v.basis.rows[0][1];
			bv[1].y = v.basis.rows[1][1];