Change ScriptsEngine API.
Small refactoring.
Fix memory leaks during scripts reloading in groovy engine.
Adopt tests for above changes.
Fix script reloading