Automatically detect the currently active view before closing tabs

This ensures that when a new tab is opened it retains the focus,
rather than the previous tab.

Fixes #14.
Merge pull request #23 from sneakypete81/focus_newly_opened_view

Automatically detect the currently active view before closing tabs