CommentStreams:C9c954ad5a1e7929e14c414bf8d37f97

hi, how can I close all applications and turn off the Raspberry pi after 5 minutes after the external power supply has been turned off?? I don't want to drain the batteries to make it shut down