# Objective
- Fix error when closing window in 2d_viewport_to_world example.
Before
```
2024-08-17T22:51:47.690252Z INFO bevy_winit::system: Creating new window "App" (0v1#4294967296)
2024-08-17T22:52:22.062959Z INFO bevy_window::system: No windows are open, exiting
2024-08-17T22:52:22.064045Z INFO bevy_winit::system: Closing window 0v1#4294967296
thread 'Compute Task Pool (5)' panicked at examples/2d/2d_viewport_to_world.rs:20:41:
called `Result::unwrap()` on an `Err` value: NoEntities("bevy_ecs::query::state::QueryState<&bevy_window:🪟:Window>")
```
After
```
2024-08-17T22:57:31.623499Z INFO bevy_winit::system: Creating new window "App" (0v1#4294967296)
2024-08-17T22:57:32.990058Z INFO bevy_window::system: No windows are open, exiting
2024-08-17T22:57:32.991152Z INFO bevy_winit::system: Closing window 0v1#4294967296
2024-08-17T22:57:32.994426Z INFO bevy_window::system: No windows are open, exiting
* Terminal will be reused by tasks, press any key to close it.
```
## Solution
- Check if the window still exists before drawing the cursor
|
||
|---|---|---|
| .. | ||
| 2d_shapes.rs | ||
| 2d_viewport_to_world.rs | ||
| bloom_2d.rs | ||
| bounding_2d.rs | ||
| custom_gltf_vertex_attribute.rs | ||
| mesh2d_alpha_mode.rs | ||
| mesh2d_arcs.rs | ||
| mesh2d_manual.rs | ||
| mesh2d_vertex_color_texture.rs | ||
| mesh2d.rs | ||
| move_sprite.rs | ||
| pixel_grid_snap.rs | ||
| rotation.rs | ||
| sprite_animation.rs | ||
| sprite_flipping.rs | ||
| sprite_sheet.rs | ||
| sprite_slice.rs | ||
| sprite_tile.rs | ||
| sprite.rs | ||
| text2d.rs | ||
| texture_atlas.rs | ||
| transparency_2d.rs | ||
| wireframe_2d.rs | ||