Reproduction steps:
1. Open the attached “BugReport_EditorWIndow.zip“ project
2. Select “Window” from Test dropdown tab
3. Click “Open Popup” button in “TestEditor” window
4. Close “Popup” window and observe the Console
Expected result: Console has no errors
Actual result: Error “EndLayoutGroup: BeginLayoutGroup must be called first.
UnityEditor.EditorGUILayout:EndVertical ()” appears in the Console
Reproducible with: 2020.3.46f1, 2021.3.21f1, 2022.2.11f1, 2023.1.0b8, 2023.2.0a6
Reproduced on: Windows 10
Not reproduced on: macOS Monterey 12.6 (Intel)