If, upon the determination of a tenancy, in any manner mentioned in the preceding section, before the end of a period for which rent is payable, the rent therefor has been paid before such determination, a proportionate part thereof, according to the portion of such period then unexpired, may be recovered back in contract.
Mass. Gen. Laws ch. 186, § 9