This app was mentioned in 8 comments, with an average of 1.25 upvotes
For the sleep timer maybe this: https://play.google.com/store/apps/details?id=robj.simple.sleeptimer&hl=en_GB
or this https://play.google.com/store/apps/details?id=ch.pboos.android.SleepTimer&hl=en_GB
should work with any music app really.
Try a sleep timer app.
I recommend "Super Simple Sleep Timer" by Rob J. https://play.google.com/store/apps/details?id=robj.simple.sleeptimer
The app is free, requires no special permissions, and is less than 1Mb in size.
I use it for Google Play Music and Pandora. I don't use Apple Music, but it should work also.
Do you want to kill it or just close it? If the latter, simple sleep timer may work, although I am not sure if you can recreate recurring shut offs. Perhaps something to look into.
I use this one on my phone. You can set it for anything from 1-60 minutes and it will stop or fade out the music. Works great.
This app works for me: https://play.google.com/store/apps/details?id=robj.simple.sleeptimer