dbquery: closes redundant connection

* mod_wsgi uses one thread to import the .wsgi file
  and a second one to instantiate the application.
  Therefore we need to close redundant conenctions that
  are allocated on the 1st thread.

Signed-off-by: Samuele Kaplun <samuele.kaplun@cern.ch>
Reviewed-by: Tibor Simko <tibor.simko@cern.ch>