Complete issue #226

Ensure that db is open before set last sequence in Replication