[FIX] sql_db: close db connexions before removing them. closes lp:1322191

See https://bugs.launchpad.net/openobject-server/+bug/1322191 and the discussions in the MP (both ocb and official)