Now closes Socket on error.