Fixed a potential deadlock in persistent sync.