If a user closes your application but does not quit it from the app switcher, you will be immediately backgrounded and allowed to execute code for a short and arbitrary period of time until your application is suspended. The system decides when you move to this state and you have no power to keep yourself alive in the background beyond what time iOS grants you.
After this time expires you are no longer allowed to execute code until you're either foregrounded by the user or receive a remote notification in the suspended state. If you receive a push while suspended, you will be allowed to execute code in the background again for a short period of time until you are suspended again.
If a user quits your app from the app switcher you will immediately switch to the not-running state and will no longer be able to execute code unless your app is relaunched. This will also prevent the system from attempting to preserve and restore the app's state on relaunch.
Developers also need to be aware that the operating system may terminate the app at any time from the background if the phone decides to reclaim the resources that keep you suspended.