Fix lock release when unexpected errors happen during the build

When I use the rbenv plugin there are many times where if a build fails in an unexpected way the .rbenv_lock file is left behind and other builds fail on the slave node because the .rbenv_lock is still present on the machine. 

This PR uses the teardown function to ensure that if a build set the .rbenv_lock that it cleans it up despite any errors that happened during the build. 

I also added --no-rdoc and --no-ri to the gem installation command to speed up installation of required gems.