Fixed ssl cleanup on other errors, and updated doc