(a) By plaintiff; by stipulation. — Subject to the provisions of Rule 20.5, an action may be dismissed by the plaintiff without order of the court:
(1) By filing a notice of dismissal at any time before service by the adverse party of an answer or of a motion for summary judgment, whichever first occurs, or
(2) by filing a stipulation of dismissal signed by all parties who have appeared in the action.
Unless otherwise stated in the notice of dismissal or stipulation, the dismissal is without prejudice, except that a notice of dismissal operates as an adjudication upon the merits when filed by a plaintiff who has once dismissed in the General Court of Justice or in any court of the United States or of any state an action based on or including the same claim.
(b) By order of court. — Except as provided by Rule 39.1(a), an action shall not be dismissed at the plaintiff’s instance except upon order of the court and upon such terms and conditions as the court deems proper. Unless otherwise specified in the order, a dismissal under this subsection is without prejudice.