I took maternity leave 3 days after my baby’s DOB as I was given mc for 14 days straight from 36 week to 38 week and just nice that gynae decided to do c-section on 37 week 4 days.
Personally I still choose to work until last day, it helps distract my mind from anxiety of the pregnancy complications I have. But probably you should stop if it’s only stressing yourself. Adding stress before delivery isn’t good for your blood pressure and baby. Know your own stress threshold.