Same here. After every time I ran my code, I would open the new project and it would be as read-only, which caused Metashape to be unstable!
I was looking for a close method for the document in my code, something like doc.close() but didn't find it in the API manual.
There is doc.open(project_name), and doc.save(), why not doc.close()?
Your solution of Metashape.Document(), does solve the problem. It enables me to open the project right after the code ran. I just don't know if that is what Agisoft expected us to do, or is there a more elegant way.
thanks