Fix for (#1588) Postgis: Concurrency problem with CursorResultSet

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.