If for any reason you would like to try a different approach, the company I work for has a program called LEADTOOLS ePrint Professional, which can be used as follows:
It installs a Windows virtual printer that can save to dozens of output formats, including PDF.
You can send it any number of print jobs, each containing one or more pages, and select the “...
You can use the command line tool, docx2pdf to batch convert word documents to pdf on Windows or macOS: https://github.com/AlJohri/docx2pdf
pip install docx2pdf
Disclaimer: I wrote this tool.