After closing a session, the focus is set to the last opened connection.
There are two settings in File – Settings – User Interface – Tree View that you can enable/disable to resolve this issue.
Those are Auto focus tab on item select and Auto select item on tab focus