If, after the defendant moves from property in compliance with an order or agreement for possession or in reasonable contemplation of its taking by the plaintiff, the proceeding is dismissed with regard to that property for any reason or there is a final judgment that the plaintiff cannot acquire that property, the court shall:
Ca. Civ. Proc. Code § 1268.620