When you call a flow from a Power App you are calling the flow Synchronously. The app will wait for a return from the flow before proceeding. The problem is that what you are doing is taking too long and the return is timing out before it can return to the Power App. You should break your flow up into two flows.
1) The flow that uploads the file to the SharePoint document library should be the one called from the Power App. But don't do any processing of the upload in that flow.
2) Then create a second automated flow that runs when a document is created in the SharePoint document library. That will trigger when the first flow uploads the file. Have that flow do the processing of all the records. That way the app doesn't have to wait for this background processing to happen before it can continue.
----------------------------------------------------------------------------------
If this Post helped you, please click "Does this answer your question" and give it a like to help others in the community find the answer too!
Paul Papanek Stork, MVP
Blog: https://www.dontpapanic.com/blog