index: report when it's locked

Report the index being locked with its own error code in order to be
able to differentiate, as a locked index is typically the result of a
crashed process or concurrent access, both of which often require user
intervention to fix.

---

This is a possible solution for #809. The error string can probably be made better.