Hi, what type of device and Android system version do you have?
Your problem might be caused by another app or feature that kills apps running in the background to save energy or boost power. When an app is closed, it cannot proceed its work. More on dontkillmyapp.com, a nice summary of how various manufacturers use these optimizing features.