Connection lifecycle fixes

Better error handling for connection failures, mostly fixes #110