MODE 2190 - Fixed the way locks are cleaned up and added some more safe guard checks in the case locks are removed concurrently.