What do you by “off”
Turning off something connected to it ?
Processor shutting down ?
Wi fi disconnects ?
Software crashes?
Did you write that stuff yourself ?
Please explain and show details of your board , how it’s powered and what is connected to it.