Music stops when closing the app using the app switcher
Music can be easily stopped as expect with apps on Android
Other application solutions:
A lot of music apps (Spotify, YouTube, YouTube Music, iBroadcast, etc) stop music playback when closed from the app switcher. If the music was started using other means, and the app is not in the app switcher, the way to close it would just be to open the app, then close it.