The defendant, at any time before execution, shall be discharged from the arrest either upon giving bail or upon depositing the amount mentioned in the order for arrest.