This may be a TLS negotiation issue in Powershell.
A possible fix is to allow TLS, TLS 1.1 and TLS 1.2 by adding the following before the request:
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls -bor [Net.SecurityProtocolType]::Tls11 -bor [Net.SecurityProtocolType]::Tls12
For more information, see:
https://blog.darrenjrobinson.com/powershell-the-underlying-connection-was-closed-an-unexpected-error-occurred-on-a-send/