Hello,
Please try using PHP CLI mode, that's issue seems some wrong configuration from IIS. Also please check default rwx access, because if the DOCX is being created then both PHP functions should return a true value.
We also recommend you using FastCGI with IIS to avoid similar issues.
Regards.