Probably happens with other things like signs with commands having their edit gui opened when used to execute. (Yes, you can put commands on signs, as well as other stuff like making signs translatable with resource packs, by messing with their NBT data)