Section 45A. If there is reasonable doubt as to the ownership of personal property or as to its liability to be attached on mesne process, before or after the attachment has been made, the officer may require sufficient security from the plaintiff to indemnify him for attaching or continuing to hold the same. If sufficient security is not furnished within a reasonable time after the officer has made a written demand upon the plaintiff or his attorney, the officer may refuse to attach such property or, if he has attached it, may release it from attachment, without liability to the plaintiff therefor. Any premium paid by the plaintiff to a surety company on a bond given as security under this section may, in the discretion of the court, be taxed as costs if he prevails in the action in which the attachment is made.