Intermittent behavior - door fails to lock consistently

Wouldn't this require the child contingency if it's going to autolock in that manner? What if the door isn't closed?

It will lock even if the door is left open. Then when someone closes the door it causes all kinds of havoc, like the lock alarm going off.