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

As you probably noticed this code is similar to the other case you fixed already:)