Welcome to
forums!!
This is happening because you have used pacman in another place and it created a lock file to prevent another instance of pacman running simultaneously. Use this command to remove the lock and try again:
sudo rm /var/lib/pacman/db.lck