Sorry for the noise, I just saw in the code:
if (java.awt.Frame.frames.find{it.title.contains("GroovyConsole")}) {
frame.defaultCloseOperation = JFrame.DISPOSE_ON_CLOSE
and I had changed the title to Groovy Console :-)
That is why it was exiting.
Cheers,
Andrea