Relaunch() sometimes not work

Hi guys, I have an electron app setting auto-restart daily at am4. It often works perfect.
A few days ago it got a problem. relaunch() not work anymore. code and device just put here didn’t change anything but it failed.

Is anyone has a similar experience? How do I start looking for possible causes and solutions?

my restart pseudo code

function checkTime(){
if (is4AM) {
setTimeout( ()=>{ app.quit() }, 3000 )

P.S. coz use AzureInsights, so I set timeout wait insights to finish.

Thank you for reading my question.