Fixed a bug where deleting the last tab would cause an
indexOutOfBoundException.