Your crash is probably caused by the timing problem of a command being started in one "thisdrawing" then ending in another "thisdrawing"
This is one of the problems inherent with using the "ThisDrawing" class. "ThisDrawing" is generally equivalent to "Application.ActiveDocument", and since OPEN, sets the last opened document as ActiveDocument, the problem will persist.
To illustrate this in action use this code:
Private Sub AcadDocument_EndCommand(ByVal CommandName As String)
If UCase(CommandName) = "OPEN" Then
Dim NewDoc As AcadDocument
Set NewDoc = Application.ActiveDocument
NewDoc.SetVariable "INSUNITS", 1
End If
End Sub
It will set INSUNITS to 1 in the already open drawing, not the newly opened drawing.
The best solution is using the code Matt posted, using the Activate event.