When the attachment is properly sued out, and the case heard upon its merits, if it be determined that the claim of the plaintiff is not established, final judgment shall be given for the defendant and his costs shall be awarded to him and an order shall be made for the restoration to him of the attached property.