I can't close documents using the closeDocument API from an CAdUiDialog derived dialog because AutoCAD reports that the documents are busy. Why does this occur?
Make sure that you call the closeDocument API from the application context (see the executeInApplicationContext API). Once you do that, you must also enable document activation (enableDocumentActivation API). CAdUiDialog disables
document activation in its DoModal override. As a result, AutoCAD cannot close documents when document activation is disabled.
The reason CAcUiDialog does this is that when you prompt for user input from your dialog then you re-enable the main frame thus giving a chance to the user to change the active document... CAcUiDialog tries to prevent this scenario.