This is a simple tip. Go to the terminal and type:

sudo shutdown -h +45

After that your system will shut down in 45 minutes.

You can also specify the exact time:

sudo shutdown -h 22:30

If you want to cancel the shutdown timer you should use the flag “-c":

sudo shutdown -c

You can also use the flag “-r" or “-s", to reboot or make the system sleep.

Read man shutdown for further documentation.