Exit the PHP process that runs the wp cli command to prevent accumulating processes. This will ensure we free up the memory right after the command has executed and returned its output.
Testing Instructions
Run on windows and try to import a jetpack backup multiple times (10 times in a row on the same site).
Verify that all of those times it worked without any issue.
To be 100% sure, also try to do the same without this fix.
While testing, keep an eye on the task manager (processes) and watch for Studio (or Electron if you're not using the executable). With this fix, the memory usage of all Studio processes should be fairly stable. Without this fix, you should see the memory go up rapidly after each import.
Pre-merge Checklist
[ ] Have you checked for TypeScript, React or other console errors?
Fixes https://github.com/Automattic/dotcom-forge/issues/8799
Proposed Changes
Testing Instructions
Pre-merge Checklist