Ensure locking/unlocking is in the system app context

Fixes the issue when setUp fails and leaves the device inside an app context.