Ok so ive done some more research and testing and in my testing i found something interesting. Also you need to make sure you go settings devicecare click the 3 dots and turn off auto optimisation and make sure that crap is off.then click battery then the 3 dots then make sure everything is disabled
Disable adaptive battery,put unused apps to sleep,sleeping apps should be empty,disable unused apps.and leave disabled apps empty. Then go to settings then app click on any app them click on battery make sure all your apps are allowed to use background activity. The one you want to keep running.
Then go to settings and acroll down to developer settings and make sure background process limit is set at standard limit
Now open 15 to 20 apps before you go to bed do not wake up un the night and touch your phone as it will kill the test.anyway when you wake up 8 to 10 hours later ypu will see all yours apps gone apart from 4 or 5.but if you then restart the phone then click apps they will be there in the recent apps again i just found this out last night.so there must be a way to keep them without restarting like you can on the note 8
Ive also noticed in delvoper settings there is a thing called standby apps you wil see the word active next to them not sure what standby apps even means but it could be related to the issues of apps closed over night.anyway you can chage ot from active to working set or you can change it to frequent or lasty rare.so if anyone has any onsite on that would be helpful
Ok so mine are all set to active meansing no battery restrictions but still the apps close over night unless you restart