ConnectionPool::urlopen(): Closing opened connections in case of error

If there's an error occur during operation, urlopen() function doesn't
close connection properly.

In my current project, I'm using the timeout and retry feature
frequently,  so a single request can be timed-out and retried as many as
20 times.
The number of requests can go up to more than 100,000, and it leads to
crash in open SSL (libcrypto.so.1.0.0.0 segment fault or double free
memory, etc.), assumingly due to the excessive number of sockets
remaining open.

After applying the modification to package code, I could get rid of such
crashes, and my project code runs stable now.
Add a test for socket closing
Merge remote-tracking branch 'origin/pr/344' into socket-closing
Fix connection closing on error.
CHANGES for #348
Removed unreachable block.
Cleanup exception testing.
Fix Py3 complaining about UnboundLocalError.
FIXME comment fix
Merge pull request #348 from shazow/socket-closing

Fix Socket closing on connection errors