The name 'VoiceCommand' cannot be resolved to an item

This might not give the results you expect.
Command events are often, not always, followed by some effect on the Items state … but it always takes time, even if only a few milliseconds.
Reading Item state after a command trigger like that will probably give you the old state, but it is indeterminate really.

You’ve already found the solution for use with rules triggered by command