Need to establish an initial Salesforce UI view and closing any residual opened tabs from last login but how?

Per the attachment, there should be no opened tabs after logging into Salesforce. How do I check if click X to close tab and repeat until no tab opened before I start my automated test?

Thanks in advance for your help,
Tien