Hi @jonyu,
this example works for me in all cases, usb and/or battery. You could try to increase the delay provided in goToPowerOff function, if you haven’t already. This would rule out, that some rest vibration is waking your board while you’re going to sleep.