I found out what the problem was. I had a space in the filename which was giving the error.
$docx->enableCompatibilityMode();
$docx->createDocx('temp/Business Plan');
$docx->transformDocument('temp/Business Plan.docx', 'temp/Business Plan.pdf');
Once I changed the name to Business-Plan, it all worked fine.