Delayed return to Idling Event?

Hi Dynamo gurus, I’m calling the Application.OpenDocumentFile(string) method to read infos of Revit families in a folder path and write a report in TXT format and then call the Document.Close() method when I’m done, nothing too complex, even if the families need to be upgraded to the current Revit version the overall task works pretty fast in a macro but when I try to replicate the same thing in Dynamo with a Python Script I have a weird behavior.
The report gets created as equally fast as in the macro but Dynamo itself seems to be hanged and after a while (we are talking about several minutes) it returns operative.
Being Revit an event-based application I’m wondering if this delay is due to some background process that keeps the Idling Event from triggering and thus putting Dynamo in a frozen state. Any thoughts? Isn’t Dynamo some kind of Modeless Dialog form? Why the focus is not returning immediatelyon Dynamo after execution?

Actually I may have just found a solution to my problem completely by chance: clicking on the title bar of the Revit window wakes Dynamo up too! Supa Dupa Weird!

If you don’t mind can you post your solution for others to see.

Sure but there is nothing more to add to what I wrote already.
It worked, but it shouldn’t be happening, at least I’d like to know why this is happening.

You can see the “solution” here http://autode.sk/2btEe2Q except that in this case (!) it naturally took only a few seconds to complete the execution, but in my previous attempts it colud take considerably much longer to do eventually complete the execution by itself.