this doesn't always work for two reasons:
1) not all connection classes are thread safe
2) some connection classes allow you to run multiple statements (queries, updates,...) and closing the connection doesn't stop the running statement, but it only stops the thread/process managing connection on client side.