Added lock to cloud-sync script