onPause

protected open fun onPause()

The background thread has is paused (which happens after 5 minutes of disuse). You can do a little (< 500ms) cleanup here.