If the defendant in the principal action causes a bond to be executed to the plaintiff with sufficient sureties, to be approved by the officer having the writ of garnishment or by the clerk of the court out of which the writ was issued, conditioned that the defendant will perform the judgment of the court, the writ of garnishment shall, upon the filing of said bond with the clerk, be immediately discharged, and all proceedings under the writ shall be vacated: PROVIDED, That the garnishee shall not be thereby deprived from recovering any costs in said proceeding, to which the garnishee would otherwise be entitled under this chapter. The bond shall be part of the record and, if judgment is against the defendant, it shall be entered against defendant and the sureties.