Release locks on error in `drainRoot`.

Closes #279.