Just found out I don't have to leave the app it works fine when I go to another screen and then come back to screen one. I still think the global variable data isn't really clearing unless I navigate away from screen one.
I'm sorry.
I read your code over the major part of a bag of chips and some dip, and I can't hold its inner workings together in my mind to trace it all, especially that data variable with its lumpy structure, all those global variables roaming free, and those procedures that exert all their influence through side effects.
If you can't find someone with more headroom, there are techniques you can use to untangle the app, involving local variables, procedures that accept parameters and emit values, and structuring of data into dictionaries.
I'm sure there is. I still don't know why it works when you leave screen one though.
I thought of one more way to get into trouble with lists of lists (tables) ...
AI2 lists are linked lists.
If you don't take care, you might find yourself with tangled list references in memory, that won't untangle until you clear them and reload from an external data store like TinyDB.
I have found the AI2 copy list block helpful in doubtful cases where I want to grab content from a list but leave the original list undisturbed. (I did not see any use of that block in your code.)
Here is a proof of the inner workings of AI2 lists: