If a defendant has given bail, he may, at any time before the forfeiture of the undertaking, deposit the sum mentioned in the recognizance with the clerk of the court in which he is held to answer; and, upon the deposit's being made, the bail is exonerated.
Ala. Code § 15-13-41 (1975)