Enhance object interface to allow closure per main suite

Now, when a function is passed to the object interface, it will
be executed once for each environment, which ensures that a clean
closure is created for each environment when running functional
tests in the test runner.
More work on WD.js replacement