Preventing simultaneous creation of lock objects. Thanks to Panos Kavalagios