Call close in the connection destructor for RAII