Fixed startup issue with notificationtask

Also some shutdown related cleanup, and an auto-shutdown on startup if
previous task hasn't been cleaned up.