Song stops playing when adding to library (Apple Music)
After looking around this is a known bug and there currently is no workaround.

On this Apple Discussion a lot of people are reporting it so you are not alone.