Add lock check missing from waitUntilFree method.