Added locking around uninstall and install

Added locking around uninstall and install