Fix tab selection when closing tabs

If you closed the first tab that was open, it wouldn't select the
first tab because the index was 2^32-1. Unsigned ints.