Safeguard against long running bg tasks by ending them in expiration handler.