Fixed tabpanel. When closing one tab, selects the last tab of the tabpanel