youtube stops when i close ipad case
YouTube prevents you from listening to music in the background unless you pay for YouTube Red. 

You can circumvent this issue by using YouTube in Safari at youtube.com instead of in the YouTube app.