Cancel SHUTDOWN if initial AOF is being written

Fixes #1826 (and many other reports of the same problem)
Merge pull request #1829 from mattsta/stop-aof-dataloss

Cancel SHUTDOWN if initial AOF is being written