Doc Change Event Question ?

Here is the code in .NET
What I want here is to close all forms if the currentDoc is a dwgand open forms if the CurrentDoc is a part or assembly
This function works fine except when I close all the documents, allforms are supposed to close because the statement "CurrentDoc isnothing"; howver, the forms are still open
Thx for any help
Chris

Function SldWorks_ActiveModelDocChangeNotify() As Integer
Dim CurrentDoc As ModelDoc2 = iSwApp.ActiveDoc
If CurrentDoc Is Nothing Or CurrentDoc.GetType =swDocumentTypes_e.swDocDRAWING Then
ClosedForms()
Else
OpenForms()
End If
End FunctionSolidworksApi macros