ERROR: Access was denied when attempting to lock the volume. Applications may be accessing this volume (code 0x80070005). ...

ERROR: Access was denied when attempting to lock the volume. Applications
may be accessing this volume (code 0x80070005).

Add the "-ForceDismount" parameter to lock the volume even when it is in use.

Type "manage-bde -lock -?" for more information.