Problems w/ detecting when a player closes a barrel with scoreboard linking system

if i wanted to run something when a barrel block is closed with the method i'm using, it would work properly only when there's one block. execute as @e[tag=block.placed,type=armor_stand] as @s at @s unless block ~ ~ ~ minecraft:barrel[open=true]{CustomName:'"Block"'} as @a at @s as @e[tag=block.placed,type=armor_stand] if score @s block.ui.index = @p block.ui.index run say DEBUG TEST this code will only work if there is one armor stand with the "block.placed" tag. Otherwise the thing would run the command when it OPENS
Continue to help post