Fix bug removing the last open tab

* Now check to see if index > 0 and the active tab is not null
Revert "Fix bug removing the last open tab"

This reverts commit f704128ee8315c358f62e405e019a1baa7204221.