Unfortunately the IRS only allows the exemption is the withdrawals are taken out after your separation from service.
The IRS rule is, that the IRS allows an exemption from the 10% penalty for withdrawals for the employee separates from service during or after the year the employee reaches age 55 (age 50 for public safety employees of a state, or political subdivision of a state, in a governmental defined benefit plan). The "during or after" relates to the age reached not when the withdrawal was made.
Prior question on the same subject answered here - <a rel="nofollow" target="_blank" href="https://ttlc.intuit.com/questions/4364945-i-took-45k-out-of-my-401k-in-2017-at-age-56-i-separated-from-service-in-2018-do-i-have-to-pay-the-10-penalty-on-my-2017-taxes">https://ttlc.intuit.com/questions/4364945-i-took-45k-out-of-my-401k-in-2017-at-age-56-i-separated-from-service-in-2018-do-i-have-to-pay-the-10-penalty-on-my-2017-taxes</a>
Unfortunately the IRS only allows the exemption is the withdrawals are taken out after your separation from service.
The IRS rule is, that the IRS allows an exemption from the 10% penalty for withdrawals for the employee separates from service during or after the year the employee reaches age 55 (age 50 for public safety employees of a state, or political subdivision of a state, in a governmental defined benefit plan). The "during or after" relates to the age reached not when the withdrawal was made.