Make sure connections are always closed

Hopefully this will prevent intermittent failures under node 0.8 on
travis.