Working addTab/closeTab func