### Godot version

v4.0.beta.custom_build [0a9e6e478]

### System information

Ubuntu, Nvidia, Vulkan

### Issue description

When a Camera2D is freed - either explicitly or by being a child of a scene that is being switched away from via a method like `get_tree().change_scene_to_file()` - then this camera somehow stays active instead of Godot properly switching to no-camera-mode.

`get_viewport().get_camera_2d()` then returns all sorts of funny things from `<Freed Object>`  (it's supposed to return `null`) to arbitrary nodes of the current scene (not cameras).

This can lead to crashes.

### Steps to reproduce

checkout the MRP.

note that the "Go to scene 2" button switches places after pressing it.
that is because a camera is still active that does not exist in the current tree.

restart it a couple of times and spam the "Go to scene 2" button.
notice the garbage output.

### Minimal reproduction project

[godot_4_camera_bug.zip](https://github.com/godotengine/godot/files/10560455/godot_4_camera_bug.zip)
}
		} else if (anchor_mode == ANCHOR_MODE_FIXED_TOP_LEFT) {
			camera_pos = new_camera_pos;
		}
		Point2 screen_offset = (anchor_mode == ANCHOR_MODE_DRAG_CENTER ? (screen_size * 0.5 * zoom_scale) : Point2());
		Rect2 screen_rect(-screen_offset + camera_pos, screen_size * zoom_scale);
		if (limit_smoothing_enabled) {
			if (screen_rect.position.x < limit[SIDE_LEFT]) {
				camera_pos.x -= screen_rect.position.x - limit[SIDE_LEFT];
			}
			if (screen_rect.position.x + screen_rect.size.x > limit[SIDE_RIGHT]) {
				camera_pos.x -= screen_rect.position.x + screen_rect.size.x - limit[SIDE_RIGHT];
			}
			if (screen_rect.position.y + screen_rect.size.y > limit[SIDE_BOTTOM]) {
				camera_pos.y -= screen_rect.position.y + screen_rect.size.y - limit[SIDE_BOTTOM];
			}
			if (screen_rect.position.y < limit[SIDE_TOP]) {
				camera_pos.y -= screen_rect.position.y - limit[SIDE_TOP];
			}
		}
		if (follow_smoothing_enabled && !Engine::get_singleton()->is_editor_hint()) {
			real_t c = position_smoothing_speed * (process_callback == CAMERA2D_PROCESS_PHYSICS ? get_physics_process_delta_time() : get_process_delta_time());
			smoothed_camera_pos = ((camera_pos - smoothed_camera_pos) * c) + smoothed_camera_pos;
			ret_camera_pos = smoothed_camera_pos;
			
		} else {
			ret_camera_pos = smoothed_camera_pos = camera_pos;
		}
	} else {
		ret_camera_pos = smoothed_camera_pos = camera_pos = new_camera_pos;