Manage scripting container in tests

As apparently, at least on my Mac, this change prevents
the EBADF related errors to occur.

Related:
http://stackoverflow.com/questions/6888281/jruby-embedding-prob-puts-appears-to-fails-with-raiseexception-errnoebadf
Merge pull request #776 from sonatype/NEXUS-6905-merge-rubygems-container-termination

[Ruby] Manage scripting container in tests