Close part or assembly at the end of the macro

Hi

I have this macro and I can not close the document at the end of the macro. What am I missing?

Dim swApp As Object

Dim Part As Object

Dim boolstatus As Boolean

Dim longstatus As Long, longwarnings As Long

Sub main()

Set swApp = _

Application.SldWorks

Set Part = swApp.ActiveDoc

boolstatus = Part.FeatureManager.EditFreeze(swMoveFreezeBarTo_e.swMoveFreezeBarToEnd, "", True)

   

Part.SaveAs (Part.GetPathName)

swapp.CloseDoc part.GetTitle()

   

End Sub

SolidworksApi macros