529 Expense and Withdrawal Timing Question

Hi, I think my 529 plan distribution is fully covered base off my expenses for 2023.  However I would love to have an expert confirm my assumption:

  • I paid $12000 out of pocket for educational expense for the spring semester of 2023 in February 2023.
  • I withdrew from my 529 plan $18000 in August 2023.
  • I paid $13000 for the fall semester of 2023 in August of 2023 after we received the distribution.

Is my withdrawal fully covered by the expenses I paid in 2023, hence no penalty will be accessed?