Section 111I. Whenever any officer or employee or former officer or employee of a city or town dies, and such city or town owes his estate any sum or sums by reason of services rendered by him or by reason of section one hundred and eleven E or section one hundred and eleven F or section seventeen E of chapter one hundred and forty-seven or other similar general or special law or by reason of other terms of his employment, and neither a duly appointed executor or administrator nor a voluntary administrator has made written demand for payment upon the treasurer of such city or town and such treasurer shall not otherwise have actual notice that proceedings relative to the formal or informal settlement of such estate have been commenced in any probate court, such sum or sums may, in the discretion of such treasurer, be paid after the expiration of one month from the death of such officer or employee to such person as may have been nominated as beneficiary, on a form approved by the director of accounts and filed with such treasurer, by such officer or employee during his lifetime or, if there is no such beneficiary, then to the husband, widow or next of kin of such officer or employee. Payments made as provided in this section shall discharge all liability of the city or town to all persons with respect to such sum or sums.