Surprisingly, I can confirm that behavior. I am using that exact same version of Inventor, and just did a test with a couple simple internal iLogic rules and found the same results. I used a For i = 1 To 5 type loop to 'create/add' 5 New part documents with Visible = False, then did nothing with them at the end of the rule, which leaves them open, but no document tabs (shows in count in Inventor's status bar). I did that twice, which showed a total of 12 open documents, because I already had two others open visibly. Then I ran a rule that checked count directly from Documents object both before and after calling that method, where both messages showed the same number, followed by another For Each type loop of all Documents, which checked if they had at least one View, and if not, uses their 'Close(True') method, and another message after that showing the total again, which was finally reduced to 2 Documents (the two that were visible - had document tabs showing).
No assemblies or drawings involved, so nothing was 'referencing' them.
Edit: After a little more testing, I found that if we used the Document.ReleaseReference method on those Document objects that we opened invisibly after done with them, then the total number of open documents is still recognized after creating the new ones, but that number is properly reduced by the CloseAll(True) method afterwards. Because of this, I am not sure if this is a bug in Inventor's behavior or not. But maybe @MjDeck could confirm if that is correct or not. And if what we initially saw is not normal / expected behavior, he may be able to get it looked into for us.
Below is an example iLogic rule I used for testing this behavior with. When Line 7 is commented, the total is not reduced by CloseAll(True), but if uncommented, it appears to work as expected.
Dim oInvApp As Inventor.Application = ThisApplication
Dim oDocs As Inventor.Documents = oInvApp.Documents
Dim oDoc As Inventor.Document = Nothing
Logger.Info("Docs Count Before Creating 5 New Ones = " & oDocs.Count)
For i As Integer = 1 To 5
oDoc = oInvApp.Documents.Add(DocumentTypeEnum.kPartDocumentObject, Nothing, False)
'oDoc.ReleaseReference() '<<< this makes the difference when uncommented >>>
Next
Logger.Info("Docs Count After Creating 5 New Ones = " & oDocs.Count)
oDocs.CloseAll(True)
Logger.Info("Docs Count After Using CloseAll(True) = " & oDocs.Count)
For Each oDoc In oDocs
If oDoc.Views.Count = 0 Then
Try : oDoc.Close(True) : Catch : End Try
End If
Next
Logger.Info("Docs Count After Closing Each With No Views = " & oDocs.Count)
Wesley Crihfield

(Not an Autodesk Employee)