updated the task scheduler to deal correctly with shutdown command, calling undo and not deleting any running tasks.