Updated close window to work on physical devices as well and when using safari launcher we connect to latest window as this is the one that safari launcher opened.