More resource cleanup.
In production files, only following changes applied:
* moved scripting container lifecycle handling
* added RubygemsGateway that terminates properly the container (by letting it be GCed)

Rest is in tests, by simply "pulling" all Ruby objects closer
to it's source and explicitly cleaning up them, as current assumption
is that EBADF errors happens when scripting container is not GCed as
some member variable still contains hard ref to it. These changes
should simply "ease" the life of GC, making it more feasible to
have them along with container collected.