Updated health check to close connection