SocketApi: Properly manage the database connections.

Removed the fishy closeDb() method of SqlQuery again.