You should understand difference between driver.close() and driver.quit()
driver.close() and driver.quit() are two different methods for closing the browser session in Selenium WebDriver. Understanding both of them and knowing when to use which method is important in your test execution.
driver.close() – It closes the browser window on which the focus is set.
driver.quit() – It basically calls the driver.dispose method which in turn closes all the browser windows and ends the WebDriver session gracefully.
You should use the driver.quit() whenever you want to end the program. It will close all opened browser window and terminates the WebDriver session. If you do not use the driver.quit at the end of the program, WebDriver session will not close properly and files would not be cleared off memory. This may result in memory leak errors.
In your case, you have to use the driver.close() which will close the current window and keeps driver active.
Just to add - if there is only browser window open and you use the driver.close(), it will quit the webdriver session. The webdriver will not stay active.