Use shared pointer reference count to track pools

By using the shared pointer reference count to track the connections
in the connection pool we no longer have to explicitly return them
to the pool.

This resolves an issue where cursor feature sets were returning their
connections before they were done with them, causing a potential race
with another connection user.
Merge pull request #1823 from thjc/master

Fix for #1588 Postgis: Concurrency problem with CursorResultSet. Thanks @thjc