Apps keeps resetting and loosing imported files. Need to start again


I have developed an app that basically does this:

  1. Import file 1 (csv)
  2. Import file 2 (csv or xlsx)
  3. Select needed columns from file1 and file2 and pass them as variables
  4. Does a bunch of operations
  5. Click a button to sequentially do a few different operations
  6. Click a button to generate export links

The problem that I currently have is that the app reset itself (need to re-enter file 1 and file 2) after item 3 or item 4 or item 5. It seems to be loading, calculating for a while and then it resets the page and I have to start the process all over again. Why is that and how can I fix it?
Thank you