Set hasTabOpen to simplify condition