Added method to check if connection open