Use tempfile to run groovy scripts

Here documents (using <<-GROOVYSCRIPT) don't work properly on windows.
The tempfile solution works all the time.
Make spec tests pass