The costs you're referring to may be part of the property cost basis rather than costs you can deduct, so it wouldn't matter when they were incurred.
Settlement fees and other costs. The following settlement fees and closing costs for
buying the property are part of your basis in the property.
• Abstract fees.
• Charges for installing utility services.
• Legal fees.
• Recording fees.
• Surveys.
• Transfer taxes.
• Title insurance.
• Any amounts the seller owes that you agree to pay, such as back taxes or interest, recording or mortgage fees, charges for improvements or repairs, and sales commissions.
Please refer to: https://www.irs.gov/pub/irs-pdf/p527.pdf
I am actually the seller of the property. I incurred legal costs associated with the sale as well as testing associated with tests required for the sale which were paid in 2020. Can these be carried?