You beat me to it, I just found this: https://mathiaspannier.wordpress.com/2016/07/17/how-to-properly-cleanupshutdown-a-delphi-isapi-which-uses-threads/
Which is essentially the same answer, can't close the connection in the finalization section when dealing with ISAPI.