(a) Lien on real property. The amount of the cost of vacating and closing or removal or demolition by the code enforcement officer shall be a lien against the real property upon which the cost was incurred. The lien shall attach to the real property upon the payment of all costs of demolition by the county and the filing of an itemized statement of the total sum of the costs by the code enforcement officer in the office of the county clerk on a lien docket maintained by the clerk for such purposes. (b) Proceeds of sale of materials. If the dwelling, building, or structure is removed or demolished by the county, the county shall sell the materials of such dwelling, building, or structure and shall credit the proceeds of the sale against the cost of the removal or demolition. Any balance remaining shall be deposited in the superior court of the county, secured in such a manner as may be directed by the court, and disbursed by the court to the person found to be entitled thereto by final order or decree.