title: Is there a way to close a tab in WebDriver or Protractor?
body: <p>Is there a way to physically close a tab via Protractor or WebDriver? </p>
  
  <p>I ask because while I know how to <a href="https://stackoverflow.com/questions/26798020/protractor-switch-to-previous-tab">switch tabs</a> programmatically, but it does not bring the active tab to the foreground. I can't always tell what is going on in my E2E tests that run on SauceLabs because when I view the screen casts it is showing the tab that I navigated away from, not the active one.</p>
  
  <p>Am I going about this incorrectly?</p>
  
  <pre><code>it('should do something in the previous tab', function(done) {
      browser.getAllWindowHandles().then(function (handles) {
          browser.switchTo().window(handles[0]);
          // do something
          expect(something).toEqual(thisThing);
          done();
      });
  });
  </code></pre>