Fix #30: Thrown exceptions leave connections in an undefined state.