Detect a closed app

Could be that Activity Lifecycle is what you need ?

or

Tools Extension by @Taifun

Also