Reproduction steps:
1. Open the attached project “repro_project“ (or “repro_project_without_graphics“ to save build time)
2. Open File > Build settings window
3. Click on “Build and run“ button
4. In the Player click on the “Exit“ button
5. Observe Player window
Expected result: The Player is successfully closed without any crash popup appearing
Actual result: The crash popup is displayed for a while and then the Player is closed
Reproducible with: 2021.3.33f1, 2022.3.15f1, 2023.2.3f1, 2023.3.0a17
Not reproducible with: 2021.3.32f1
Reproducible on: Windows 11, MacOS 14.0 (Intel)
Not reproducible on: No other environment tested