fix sqlite rollback-transaction in case of auto-rollback error

Merge to release branch.

An invalid (needs-rollback?) transaction may correspond to a closed
underlying transaction. In that case, don't issue ROLLBACK command.