Improved performance of shutting down the engine

git-svn-id: http://svn.code.sf.net/p/angelscript/code@2004 404ce1b2-830e-0410-a2e2-b09542c77caf