Cancel a shut down command
This isn't a perfect solution and won't always work, but it is definitely worth trying if you suddenly remember you have to do one last thing before you shut down. The best conditions for this seem to be when you have lots of open applications and when the shut down seems to be taking quite a while.
From the article:
Have you ever told your machine to shut down, and then remembered that you had one last thing you wanted to do—send an email, check the weather forecast, or pay a bill online, for instance? Once the shut down process has started, it seems you’re out of luck—there’s no obvious way to cancel a shut down command.
However, there are two things you can do that will prevent your machine from shutting down. Either one should work, assuming you have enough open applications that the shut down process is taking a bit of time.