This has been fixed in recent versions of IntelliJ. However, it requires you to change a setting:
- Preferences>>Editor>>General>>Editor Tabs
- Set When closing active editor: to Activate most recently opened Tab
This has been fixed in recent versions of IntelliJ. However, it requires you to change a setting: