Do not close background job too early
Merge pull request #11 from nicolas-f/fix/groovy

Do not close background job too early.
This is useful for canceling the execution of a Groovy script.