Switch to the new opened tab. Close the current windows(In this case the new Tab). Switch back to first window.
PROTRACTOR:
browser.getAllWindowHandles().then(function (handles) {
browser.driver.switchTo().window(handles[1]);
browser.driver.close();
browser.driver.switchTo().window(handles[0]);
});
JAVA Selenium:
Set<String> handlesSet = driver.getWindowHandles();
List<String> handlesList = new ArrayList<String>(handlesSet);
driver.switchTo().window(handlesList.get(1));
driver.close();
driver.switchTo().window(handlesList.get(0));