Section 24. Proceedings under sections eighteen and twenty-one, if the spouse of such a person who is incapacitated by reason of mental illness is an inhabitant of the commonwealth, shall be in the county where said spouse resides, otherwise in a county where any of said spouse's real estate is situated, and a certified copy of all final orders or decrees in such proceedings shall be recorded in the registry of deeds in every county or district where such real estate lies.