Any person confined in a county department of corrections facility, state prison, or other place of detention may, under necessary precautions and upon approval of the assets of the estate, pay debts, and distribute residue to those entitled to it.”>administrator of the institution in which said person is confined, be taken by some regular or specially authorized officer from such place of detention to a state or federal court within the state of New Hampshire to appear in a proceeding before that court. During the time period such person is in a state courthouse, the sheriff, through the sheriff’s deputies and bailiffs, shall be responsible for such person’s custody and control.