If you create a new document, the function updateDocumentOrder() won't execute. When a new document is closed, the code has to be executed. You can check this with the property Source.Document.IsNewNote. Change the code in the QueryClose event like this:
Dim vNewSection As String<br/>
<br/>
...<br/>
<br/>
If Not vSection = "" Or Source.Document.IsNewNote Then<br/>
...<br/>
End If