Check if connection is closed