17. Where a defendant has been ordered to make an interim payment or has in fact made an interim payment, whether voluntarily or pursuant to an order, the Court may, in giving or making a final judgment or order, or granting the plaintiff leave to discontinue his action or to withdraw the claim in respect of which the interim payment has been made, or at any other stage of the proceedings on the application of any party, make such order with respect to the interim payment as may be just, and in particular —
an order for the repayment by the plaintiff of all or part of the interim payment;
an order for the payment to be varied or discharged; or
an order for the payment by any other defendant of any part of the interim payment which the defendant who made it is entitled to recover from him by way of contribution or indemnity or in respect of any remedy or relief relating to or connected with the plaintiff’s claim.