The officer or other person having such debtor in confinement or custody shall be exonerated, on making a return of the order aforesaid, on the process by which such debtor was held, and such order being filed with any officer or magistrate, by whom any bail piece was issued, shall entitle the bail to be exonerated, as effectually as if the debtor had been surrendered and confined in prison on such bail piece.
39 P.S. § 247