Added locking in ImplementDuckType and ImplementGlobalDuckType

Added locking in ImplementDuckType and ImplementGlobalDuckType to prevent 'item with the same key has already been added' error occurring on application start when there are multiple concurrent requests.