Further improved connection teardown (more graceful). Fixes #18.