Cancel SHUTDOWN if initial AOF is being written

Fixes #1826 (and many other reports of the same problem)