$children=@(Get-CimInstance Win32_Process -Filter "ParentProcessId = $($l.pid)"|Select-Object ProcessId,ExecutablePath)
if(!@($children|Where-Object{$_.ExecutablePath -eq $l.bundledRuntimeExpected}).Count){throw 'Bundled worker path not found'}
$modal=[Native41]::Top([uint32]$l.pid,'Roster health')
$null=[Native41]::SetForegroundWindow($modal);Start-Sleep -Milliseconds 250
if([Native41]::GetForegroundWindow() -ne $modal){throw 'Owned health dialog not foreground'}
[Native41]::keybd_event(13,0,0,[UIntPtr]::Zero);Start-Sleep -Milliseconds 100;[Native41]::keybd_event(13,0,2,[UIntPtr]::Zero)
Start-Sleep -Milliseconds 500
$null=[Native41]::PostMessage($main,16,[IntPtr]::Zero,[IntPtr]::Zero)
@{utc=[DateTime]::UtcNow.ToString('o');pid=$l.pid;workerProcesses=$children;bundledWorkerConfirmed=$true;requestedNormalClose=$true}|ConvertTo-Json -Depth 5|Set-Content "$o\ui-close.json"
