how to keep kodi running?



hi i made a remote to control my kodi laptop from my phone.i send ssh commands to launch and stop kodi and this has allways worked when kodi was in the apt list but now i have upgraded to flatpak version and when i launch kodi its fine but when i leave the app it kills kodi as nohup does not work

my old command
(“export DISPLAY=:0\n”+”nohup “+”kodi”+”\n”);  //this worked fine

but this one closes kodi when i leave to switch to kodi remote
(“export DISPLAY=:0\n”+”nohup “+”flatpak run tv.kodi.Kodi”+”\n”);

anyone know how i can get kodi to stay open when the phone closes session? thanks