Added Qt5 support, and Close connection on response->end()