checking connection inside loop

If NOT connected, then close connection?