So, if what @Thomas_Volker suggested doesn’t work you can always create a global error handler and run this VB script. This will start the scripting engine and check if the title of the active window is “SAP Logon 750”. If true, it will close the that window. This isn’t the best way, but it will probably work.
Dim SapGuiAuto As Object
Dim SAPApp As Object
Dim SAPCon As Object
Dim session As Object
SapGuiAuto = GetObject("SAPGUI")
SAPApp = SapGuiAuto.GetScriptingEngine
SAPCon = SAPApp.Children(0)
session = SAPCon.Children.ElementAt(0) ' <--- Assumes you are using the first session open. '
If session.ActiveWindow.Text = "SAP Logon 750" Then
Let me know if you have any questions.