Also exit the loop if the SSL connection is closed