(a) During the trial of an indictment for a misdemeanor, the defendant may remain on bail.
(b) However, for a felony when a defendant is upon bail, he or she may remain upon bail or be kept in actual custody as the court may direct. If the defendant remains on bail, any surety's liability shall be exonerated unless the surety has agreed to remain as the surety until final judgment is rendered.