I've managed to fix the issue, the fix seems to have been to use socket.setdefaulttimeout(10), I'm not sure why this works but not s.settimeout(10) but now the server has been running for 6 days without issues (it used to run for about 8-12 ish hours halting), there are now 0 connections stuck in the closed wait state.