You can also use UI Automation to close Edge window.
'* Add a Reference to the UIAutomationClient Library(UIAutomationCore.dll)
Public Sub CloseEdgeWindow()
Dim uiAuto As CUIAutomation
Set uiAuto = New CUIAutomation
Dim elmRoot As IUIAutomationElement
Set elmRoot = uiAuto.GetRootElement
Dim cndChromeWidgetWindows As IUIAutomationCondition
Set cndChromeWidgetWindows = uiAuto.CreatePropertyCondition( _
UIA_ClassNamePropertyId, _
"Chrome_WidgetWin_1" _
)
Dim aryChromeWidgetWindows As IUIAutomationElementArray
Set aryChromeWidgetWindows = elmRoot.FindAll(TreeScope_Children, cndChromeWidgetWindows)
Dim wptn As IUIAutomationWindowPattern, i As Integer
For i = 0 To aryChromeWidgetWindows.Length - 1
If aryChromeWidgetWindows.GetElement(i).CurrentName Like "*- Microsoft" & ChrW(&H200B) & " Edge" Then
Set wptn = aryChromeWidgetWindows.GetElement(i).GetCurrentPattern(UIA_WindowPatternId)
wptn.Close
End If
Next
End Sub