I finally got this issue resolved. It had nothing to do with my code.
The issues was being cause Trend SSL monitoring software which was installed in the server. Once the software was disabled, the errors instantly vanished.
It's not a great answer, but hopefully it will help someone else.