Section 4. If land, which was not attached on mesne process in the action in which the execution issued, is taken on execution, the officer shall forthwith deposit in the registry of deeds for the county or district where the land lies a copy of the execution with a memorandum thereon that the execution is in his hands for the purpose of taking the land of the defendant, and no such taking shall be valid against a purchaser in good faith, for value and without notice, before such copy is deposited. If land was attached on mesne process, a copy of the execution with a memorandum as aforesaid shall be deposited by the officer in the registry of deeds for the county or district where the land lies, within forty days after the date which appears on the execution issued upon the judgment in the action, and the attachment shall become void forty days after said date unless the copy is so deposited; provided, that if land was attached on mesne process in Nantucket county and judgment was rendered in another county, or if judgment was rendered in Nantucket county and land was attached in another county, said copy shall be deposited within seventy days after the date which appears on the execution issued upon judgment in the action, and the attachment shall become void seventy days after said date unless the copy is so deposited.