Added cleanup and reset methods to ScriptingCore.

Best viewed with whitespace changes ignored: https://github.com/cocos2d/cocos2d-x/pull/2023/files?w=1

Re-filed #2017 without ``externalScriptPath`` functionality. See details in #2017.