You can use the switch_to.window() method to switch back to the main window using its handle.