If you could post the rest of your script, it would be helpful. It's likely that you have a hook into something that you do not dispose of properly. A view, doc, sheet, or something. Normally you would use a command like
object = Nothing
to kill it after it's done being used, and before you attempt to close the application. The scripting engine can take care of some unhandled objects, but maybe not all. Have a look at that throughout your script and see if perhaps it makes a difference.