In Android there is an excellent SSH client called JuiceSSH, comparable to Windows and Linux clients, only a little more uncomfortable to use due to the lack of a physical keyboard and mouse. By default we can divide the screen and use it together with other applications, but when we switch directly to another application and then return to it without closing the session, it still closes. Although JuiceSSH does not close the session and is designed to continue in the background, an Android feature designed to save battery called "App launch", is responsible for closing it without our consent thinking that this is the best for our phone as this feature is automatic on by default.
This feature automatically manages the execution of all the applications of our Android and works from version 9 onwards, although it could be that in some previous ones as well.
To prevent this feature from closing our SSH session.
Open "Settings" > "Apps" > "App launch" and search for "JuiceSSH" in the list.
We deactivate the button that appears next to the name until it says "Manage manually", and there we activate the 3 options that are: "Auto-launch", "Secondary launch" and "Run in background", select "OK", and we will no longer have problems.
After doing this, when we leave a session open, it will remain the same unless our remote server is configured to close the session after a certain time of inactivity. To close a session without opening the application again, use the notification manager, expand the application notification and select "Disconnect", otherwise the application will continue with the session open. You have to take into account that although it is a bit confusing, the previous steps are, deactivate the automatic management and activate the 3 execution options.
There is no contraindication in this regard, the only detail is that you have to be careful not to move the management of other applications if it is not necessary. In addition to the fact that if we ever forget to close the session of our client we will cause the battery of our smartphone to drain a little faster unnecessarily.