Switching to new window and switch back to main window