Fall back to last tab after closing another #381

Regarding issue #381, this pull request deals with falling back to the last tab accessed after the active tab has been closed. This does not work with the settings tab, because unfortunately the settings tab is a different kind of tab. See issue #479 for more details.