Fixes in a2_KillVoicesUsingProgram()

No longer using a2_GetProgram(), since that fails with zero refcount
handles, which is precisely what we'll normally see here.

Fixed an old bug in a2_KillVoicesUsingProgram(); it didn't actually
check if voices were running the specified program!

Cleaned up the handle error checking and locking in the state loop.