Implement lock disposal.

When disposing a lock instance the instance asserts that it has no locks
outstanding. The lock identifier is recycled.

Closes #31.