At any time before final judgment against them, the bail may be exonerated, either by the death of the defendant or his imprisonment in a State prison, or by his legal discharge from the obligation to render himself amenable to the process, or by his surrender to the sheriff of the county where he was arrested, in execution of the judgment.
N.C. Gen. Stat. § 1-433