Send QUIT command only when connected