at groovy.util.GroovyScriptEngine.getResourceConnection(GroovyScriptEngine.java:126) there is a resource leak:
groovyScriptConn.getInputStream();
The inputStream returned is never closed.
Since this code block goal is to check whether the resource exists or not, one possible solution would be:
groovyScriptConn.getInputStream().close();
or, as another alternative, adding a finally {} block, after catching the exceptions, in where that input stream would be closed (and any potential exception would be handled).