establish connections before teardown to avoid capistrano bug

https://github.com/capistrano/capistrano/pull/416