title: MaxRetryError when scraping with selenium: happens when I quit and relaunch the browser
body: <p>This is the snippet of the code. The error occurs in the last try-except block where I attempt to quit and relaunch the browser in case I encounter a TimeOut Exception.
  Here is the error I get:</p>
  
  <blockquote>
    <p>MaxRetryError: HTTPConnectionPool(host='127.0.0.1', port=65067): 
        Max retries exceeded with url: /session/819e6b641d55d1739500557218c88ce7/url 
        (Caused by NewConnectionError(': 
        Failed to establish a new connection: [WinError 10061] 
        No connection could be made because the target machine actively refused it')) </p>
  </blockquote>
  
  <p>Code:</p>
  
  <pre><code>def log_in(driver,uc_link,time_to_sleep):
              driver.get(uc_link)
              time.sleep(random.uniform(2,3))
              oldTab = driver.window_handles[0]
              driver.find_element_by_link_text("S&amp;P Global NetAdvantage").click()
              time.sleep(time_to_sleep)
              """Change Focus to the new tab"""
              newTab = driver.window_handles[1]
              driver.switch_to_window(newTab)
              driver.switch_to_window(oldTab)
              driver.close()
              driver.switch_to_window(newTab)
              time.sleep(time_to_sleep)
  </code></pre>
  
  <p>#The loop</p>
  
  <pre><code>for num in range(start,end):
          print(num)
          b=len(name_found)
          try:
              if is_login(driver):
                  log_in(driver,uc_link,5)
                  try:
                      wait.until(driver.find_elements(By.ID, "ctl18_bottomBarLogo")) 
                  except TimeoutException:
                      print("Log in taking too long")
                      driver.quit()
                      log_in(driver,uc_link,5)
              comp_name = fh['company1'][num]
              sp_comp = driver.find_element_by_id("SearchTopBar")
              sp_comp.clear()
              sp_comp.send_keys(comp_name)
              driver.find_element_by_xpath('//*[@id="ciqSearchSearchButton"]/input').click()
              try:
                  wait.until(lambda driver: driver.find_elements(By.ID, "CompanyHeaderInfo_CompanyHeaderInfo_BinderToolbar") or driver.find_elements(By.ID, "dropdownContainer"))
              except TimeoutException:
                  print("Time Out")
                  driver.quit() #Here is where the problem occurs
                  #driver.refresh()
                  time.sleep(10)
                  log_in(driver,uc_link,5)
                  continue
  </code></pre>