How to debug closed connection error
Disable all modules, including all core modules, that are not absolutely necessary for the failing functionality (uploading images). If the minimal configuration is working, enable each module one-by-one and test until the error occurs again, then you got the culprit. 

In particular, disable Database logging.  

If the basic install still causes the problem, start reading the server logs (it wouldn't hurt to check them immediately, but they might be empty), and check the server configuration.