I had this kind of error at the very end of one of my applications, and it happened to be an issue in one of the finalize of the units I was using.

I think you should check the initialize section of all the units you are using, the problem must be there.