For #465, Add an onComplete callback to tasks, so that preLogoutTasks really are pre-logout