bugfix: release database connection when query is done