You are not switching to new window. For this save the original window
then get the window handle of the new window and switch to that.After new window work is done ,
close the to and switch to original window handle. Use below code for reference
String parentHandle = driver.getWindowHandle();
driver.findElement(By.xpath("//*[@id='someXpath']")).click();
for (String winHandle : driver.getWindowHandles()) {
driver.switchTo().window(winHandle); // switch focus of WebDriver to the next found window handle
}
//code for on new window
driver.close(); // close newly opened window
driver.switchTo().window(parentHandle); // switching back to the original window