If any town, at the annual meeting, shall fail to elect a treasurer and fail to adopt the provisions of RSA 41:26-e, it shall be the duty of the selectmen to appoint a treasurer within 6 days thereafter, to hold office during their pleasure or until another is chosen or appointed and qualified in his or her stead; and they shall fix the appointed treasurer's compensation and make a written contract with him or her in relation to it.