Fixes the View Deck tab bug.

Fix the bug that opened a new tab every time the show deck button is pressed. Also, makes sure that when a tab is closed, the selected tab is the main one and not the one with the one higher index.