We run Procmon this way:
C:\Tools\Procmon.exe /AcceptEula /BackingFile C:\cvex\procmon.pml /LoadConfig C:\cvex\config.pmc /Quiet
Then we terminate it this way:
C:\Tools\Procmon.exe /AcceptEula /Terminate
Sometimes Procmon.exe keeps running and it keeps collecting the events. If it gets terminated via taskkill, then the log file gets corrupted:

It hangs on:
C:\Tools\Procmon.exe /AcceptEula /OpenLog C:\cvex\procmon.pml /SaveAs C:\cvex\procmon.xml
Please find out what is the issue with Process Monitor and why it is not always terminating properly.