Confirm close before closing after hitting 'x' on tab

When running multiple concurrent sessions, I’ll click back and forth between windows/sessions frequently. If I misclick and hit the ‘x’ in the tab, it immediately closes without confirmation. Having a confirmation option here would be great, as I might have batch processing running, which leaves the situation in a weird half-done state.

Even 30 years ago software was smart enough to warn you before closing an unsaved document. Lack of such feature shows disrespect towards work and workers.