SolidWorks Shuts-Down unexpectedly when I just want to close the ModelDoc.

I have used this same code below, at the end of all of my sub-routines to close out a part or assembly file and now when I use it, it is closing down SolidWorks.  Any idea's what is causing this?

    swModel.EditRebuild3

    swModel.ViewZoomtofit2

    swModel.SaveSilent

    swApp.CloseDoc swModel.GetPathName  'This is the line in which SolidWorks closes, I just want the modeldoc to close, not the program.

    Set swModel = Nothing

I don't get any error message during run-time, or when I step-through.  SolidWorks just closes unexpectedly.  Here is the code for the entire sub routine:

Private Sub Test1()
                         
Sleep 3000

    Dim swModel                   As SldWorks.ModelDoc2
    Dim strNewPathName      As String
    Dim runMacroError          As Long
    Const strOldFileName     As String = "305701"
    Const strFileExt             As String = "sldprt"
   
    strNewPathName = GetNewPathName(strOldFileName, strFileExt)
   
    'Open the model
    If strFileExt = "sldprt" Then
        Set swModel = swApp.OpenDoc6(strNewPathName, swDocPART, swOpenDocOptions_Silent, "", 0, 0)
    Else
        Set swModel = swApp.OpenDoc6(strNewPathName, swDocASSEMBLY, swOpenDocOptions_Silent, "", 0, 0)
    End If
   
    On Error GoTo ErrorHandler
  
    Custprop = swModel.DeleteCustomInfo2("Default", "ShopOrder")
    Custprop = swModel.DeleteCustomInfo2("Default", "Drawn")
    Custprop = swModel.DeleteCustomInfo2("Default", "Checked")
    Custprop = swModel.DeleteCustomInfo2("Default", "Date")

   
    Custprop = swModel.AddCustomInfo3("Default", "ShopOrder", swCustomInfoText, strJobnumber)
    Custprop = swModel.AddCustomInfo3("Default", "Drawn", swCustomInfoText, strDrawn)
    Custprop = swModel.AddCustomInfo3("Default", "Checked", swCustomInfoText, strChecked)
    Custprop = swModel.AddCustomInfo3("Default", "Date", swCustomInfoText, strDate)

  
swApp.RunMacro2 "C:\MY DOC'S\Disfunctional Macro.swp", "Airside_Extended_Tubesheets", "Main", swRunMacroDefault, runMacroError
  
    'Rebuild, Save and close the model
    swModel.EditRebuild3
    swModel.ViewZoomtofit2
    swModel.SaveSilent
    swApp.CloseDoc swModel.GetPathName 'This is the line in which SolidWorks closes, I just want the modeldoc to close, not the program.
    Set swModel = Nothing
Exit Sub

ErrorHandler:
    MsgBox "Wrong ItemID Try Again 701!"

End Sub

SolidworksApi macros