LibreOffice process is stuck when convert to pdf fails

Hi all,

I am using LibreOffice to convert several file types to pdf from an mvc application running on iis window server 2012 by using the next lines of code:

Process p = Process.Start(@“C:\Program Files (x86)\LibreOffice 5\program\soffice.exe”, "–headless --convert-to pdf " + oldFName + " --outdir " + outdir);

p.WaitForExit();

But when I try to convert an illegal file format LibreOffice process is stucked and I can no longer convert other files.

Can anyone advice a solution for it?