Replace backslash escape only in old posts after import

Try adding

   post.save

At the end of the loop