selenium webdriver invalid login
<p>i want  to close the browser for an invalid username/password but i am not able to do that. It runs well for a valid input though but for an invalid one it just freezes in the page where it shows "invalid login". this is my code. setup1 is just opening the browser.</p>

<p>while(recordset.next()){</p>

<pre><code>                   setUp1();
                   System.out.println(driver1);
                  driver1.manage().timeouts().implicitlyWait(3000, TimeUnit.SECONDS);       

               System.out.println(recordset.getField("NAME"));
               System.out.println(recordset.getField("PASSWORD"));

               String store1 = recordset.getField("NAME");
               String store = recordset.getField("PASSWORD");


                driver1.findElement(By.id("signin_button")).click();
                driver1.findElement(By.id("user_login")).clear();
                driver1.findElement(By.id("user_password")).clear();
                driver1.findElement(By.id("user_login")).sendKeys(store1);
                driver1.findElement(By.id("user_password")).sendKeys(store);

                driver1.findElement(By.name("submit")).click();


                driver1.findElement(By.xpath("//div/ul[@class = 'nav float-right']/li[3]")).click();            
                driver1.findElement(By.id("logout_link")).click();
</code></pre>