Synchronize all access to the underlying PG connection

It's not thread-safe, and we need to safely issue queries from both the
owning thread and the reaper.