The statute permits the dismissal of a cause of action where "there is another action pending between the same parties for the same cause of action in a court of any state or the United States; the court need not dismiss upon this ground but may make such order as justice requires." The motion court may providently exercise its discretion by dismissing the action without prejudice.
Seagate Mini Mall, Inc. v. Khlebopros, NY Slip Op 07306 (2d Dep't October 9, 2019)
Here is the decision.