// Close 1 window and check that 1 is left
d.close();
assertEquals(1, d.getWindowHandles().size());
// Switch to that window
d.switchTo().window("google");
assertNotNull(d.getWindowHandle());
// Close the remaining window and check now there are no windows available
d.close();
assertEquals(0, d.getWindowHandles().size());