Ensure beanstalk connection is closed when tool finishes

This change ensures that `bs.close()` is always called on the connection.

This makes the code for Python 2.6+ due to using the with statement.