[Ide] Fix document closing issue

Fixes bug #22278 - Closing tabs with Apple+W leads to lost focus/blank editor