BLE: Peripheral device won't disconnect when app is closed

Using BLE to connect to an device (not bond, just scan and connect) on Android (in this case Android 7) does not disconnect when the app is closed. The peripheral device is still connected.

I just wonder, how to check if Android disconnects or send events to the peripheral device for that reason? How to debug it?

Any guesses / idea / experiences are welcome.
My current solution is to send a heartbeat. Just a message on a chracteristic. So that the device disconnects when the timeout is fired. But I want a more official solution. Sending a heartbeat on a single thread application is not the best idea.

I just expect: When the app established the connection, it should disconnect when the app is closed.

Update: I tested it with another bluetooth app. And the disconnect works on app is closed. I think it’s a problem of the BLE plugin or the type of app (web app / browser / Ionic / Cordova).