What does "in background" mean?
In Windows 10, "in foreground" means the app is visible, or the app window is not minimized on Windows 10 desktop. If the app is not in foreground, it is in background.
Why is the app stopped in background?
Possibility 1: You closed the app. Windows doesn't allow closed UWP app run long background tasks.
Possibility 2: You minimized the app, and Windows stopped the app for your battery life.
How can I prevent this?
Don't close the app when you are using it. Minimize it instead. To make the app keep running in background, launch the "Settings" app, goto "Systems" - "Battery" - "Battery usage by app". Find this app and uncheck "Let Windows decide when this app can run in the background" and check "Allow app to run background tasks".