Fixes incorrect tab selection after process death (cherry picked from commit 8ff2c01bf28d9d645796b7e616d3ab5c6f85a86c)