VBOX_E_INVALID_OBJECT_STATE

This can happen after messing about with linked clones (specifically, trying to unlink them).

The lock is not in the vdi file itself; the lock state appears to be stored in
the virtual media manager.
The solution is to:
shut down all VMs
unload and reload the vbox kernel modules

Then the lock should reset.