Hello Bolli,
Try to use the lines inthe following order:
doc = Metashape.Document()
doc.save(export_path + '/' + proj_name + '.psx')
chunk = doc.addChunk()
chunk.addPhotos(...)
doc.save()
chunk.matchPhotos(...)
...
doc.save()
Metashape.app.document and Metashape.app.document.chunk wouldn't work for the scripts started outside Metashape GUI.