Hello,
From your description, your app can go to background, but all the tasks on the page have been end.
As I understand, you want to remove the token when the app is going to close, and you have to remove the token in a task.
If so, please create Background-Safe Tasks, and remove the token in the task. After removing the token, you can refer to the solution in the previous thread to close the app.
App.Current.Quit();
If you have any other issues, please feel free to let me know.
Best Regards,
Wenyan Zhang
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.