Added lock to any config writing operation.