setTheme() restarting application Vaadin 6.8.4

Hi guys, im new on this forum. Could You tell me why my application is restarting after setting new theme?

@SuppressWarnings("serial")
public class MainApplication extends Application implements LoginListener, TransactionListener{

    private static final ThreadLocal<MainApplication> currentApplication = new ThreadLocal<MainApplication>();
    private User user;
    
    @Override
    public void init() {        
        setCurrent(this); 

        startLoginWindow();
        if (getContext() != null) 
            getContext().addTransactionListener(this);
        
    }
    
    public User getLoggedUser(){
        return user;
    }
    
    public void startLoginWindow(){
        this.setTheme("loginTheme");
        this.removeWindow(this.getMainWindow());
        LoginMvc loginMVC = new LoginMvc(this);
        this.setMainWindow(loginMVC.getWindow());
    }
    
    public void startMainApplication(User user){            
        this.removeWindow(this.getMainWindow());
        this.user = user;
        setTheme("mainTheme");
        MainWindowMVC mainMvc = new MainWindowMVC(this);
        this.removeWindow(this.getMainWindow());        
        this.setMainWindow(mainMvc.getWindow());
  //happens after this method and I find that the "setTheme()" method is responsible for this

    }

    @Override
    public void onLogin(LoginEvent event) {
        startMainApplication(event.getUser());
    }

    @Override
    public void onLogout(LoginEvent event) {
        startLoginWindow();
        removeCurrent();
    }

    public static MainApplication getCurrent() {
        return currentApplication.get();
    }
 
    public static void setCurrent(MainApplication application) {
        currentApplication.set(application);
    }
    
    public static void removeCurrent() {
        currentApplication.remove();
    }
    
    @Override
    public void transactionStart(Application application, Object transactionData) {
        if (application == this) {
            MainApplication.setCurrent(this);
        }
    }

    @Override
    public void transactionEnd(Application application, Object transactionData) {
          if (application == this) {
                removeCurrent();
            }
        
    }


}

Can anyoune help me ? I forgot to add that the application is restarting in chrome and IE, it works fine in mozilla, opera and the eclipse browser.