When screen closed

so i want to do when user close app then call tinyDB to store value of his points

When screen closed or when app is closed?
Does the user actually close the app or just put it in the background (user uses button in app to close application, or just presses back/home button on device)?

Screen Closed is too late.

Update TinyDB the moment the score changes.

Use TinyDB lookup result to update the score.

close app

please explain how.....

Probably you can store the value when points are updated or after every time interval. As when the app is closed, current running activity closes down.

Use the ActivityChanged event of the tools extension

If state = stop
Then save values