Added closed check to the connection Close and SendQuery methods