The following code doesn't lock the active layer. It also doesn't produce an error..
activeDocument.activeLayer.locked=true
Printing the current locked value of the layer does work:
print(activeDocument.activeLayer.locked)
Fixed in the upcoming version 2.0.018.