I have no idea why as that script should have no impact on the dialplan until "hangup". Perhaps a copy of a call from the "full" log would helpfully provide timestamps to possibly show any delays,
I will comment though that you call the script with ^{ARG3}, again why? , your post is not actually a complete working script as there is no initial hash/bang line apparent, $dtpath is neither apparently defined and I would not run any command through nice yet.
Perhaps you could post the script in it's entirety.
The purging could be good for deleting recordings over 365 day to conserve disk space and remain compliant, deleting the cdr records really won't save any space though.