Postgres connection getting closed

I may have been a bit daft suggesting that anyways – I just realized your post mentions Postgres, not Microsoft SQL Server.

In this similar thread, it was related to memory exhaustin on the Postgres database side.

Are you sure your Postgres DB is sized appropriately? It would be useful to have a DBA (if you have one around) monitor memory / CPU utilization.