Any judge of a court of record of this state whose services have terminated, otherwise than by retirement under provisions of this article, shall, upon his written demand, or the written demand of his personal representative, filed with the State Auditor, by a proper warrant of the State Auditor drawn on the fund, be refunded, without interest, any and all money paid by or for said judge into the fund. Such repayment shall terminate all rights of said judge to participate thereafter at any time in the benefits and pay of the retirement system, without prejudice, however, to his right to reenter the system after a subsequent appointment or election to a qualified judgeship, but without credit for any prior years of service: Provided, however, That should a retired judge die, without leaving a widow surviving, while receiving retirement benefits under the provisions of this article, and before he has received from the Judges' Retirement Fund an amount equal to, or in excess of, sums paid by him into such fund, or should the widow, as defined by section six-b of this article, who is entitled to an annuity under the provisions of section six-b die or remarry while receiving annuity benefits, and before she and her husband have received from the Judges' Retirement Fund an amount equal to, or in excess of, sums contributed by him to such fund, then, and in either of these events, the State Auditor shall, upon the written demand of the personal representative of the judge or widow, as the case may be, filed with the State Auditor, by a proper warrant drawn on the fund, refund, without interest, to the estate of such judge or such widow, as the case may be, an amount equal to the difference between the sums contributed to the fund by or for such judge and the amount of such retirement benefits and annuities paid to him and his widow.