The sheriff having in his hands at the expiration of his official term any money held by him subject to the further order or judgment of any court shall, on the demand of his successor in office, pay the same to him and on such payment shall be discharged from further liability therefor.