[BUG #8678] Fixed updating currentIndex when a page is removed