[transfer-engine] Better attemp at fixing the QSqlDatabase leak

Patch fixes the leak problem so LGTM.