Wrong tab is shown after tab is closed or deleted

If the change is the cause of your problem, there is a feature request asking for an option for the old behavior: