Fix crash on sync due to collection being closed
Merge pull request #553 from timrae/issue2328

Fix crash on sync due to collection being closed