FWIW jyst thinking out loud
Could it be the program is too fast…
What happens if you build in some pauses. If you are exporting to DWG via rhinoscript commands there is a good chance the exporter is still running or the exported files are handled in the background while your program already moves on. Maybe you can find a way to see of the DWG is written to file and ‘finalized’ before your program progresses to the next steps.