Call closed() method only when the connection is genuinely in the