Delete subtabs properly. [refs #4711 and spent 1 hour on #4711]