Restart the computer and compare the results.
Similar issue post for your reference:
Make sure the “Desktop Experience” feature is installed.
Go to Server Manager -> Features -> Add Features -> Install Desktop Experience. After adding the feature, you need to restart the server.
Make sure the WebClient service is enabled and started.
Click Start -> Control Panel -> Administrative Tools -> Services->start the WebClient service.
According to SharePoint: How to close a Modal Dialog Window, under "Methods to close Modal Dialog Window" it states (emphasis mine)...
To close a Modal Dialog Window we can employ the methods shown below. Note that the methods become accessible through the window.frameElement after the dialog has been opened/created, in other words, SP Dialog framework ...