How can I prevent stuck keys when VNC into OS X El Capitan loses focus? tl;dr: I'd like to avoid OS X thinking the [Command] key is being held down when I [Alt][Tab] away from a Windows TightVNC session, or at least get the [Command] key to auto-release after a period of time.

I'm using TightVNC on a Windows 8 x64 box to access a Mac OS X El Capitan box through standard built-in OS X Screen Sharing.

The combination works great for my purposes, with one exception: when TightVNC has focus and I hit [Alt][Tab] on the Windows box to switch focus to another application, the OS X understandably sees the [Alt] key go down, but never come back up.

Because the Windows [Alt] key maps to the OS X [Command] key, the OS X box is left thinking I never released the [Command] key.

Therefore, when I return to the TightVNC session a minute, hour, or month later and begin typing, the results are often surprising and sometimes bad, because OS X still thinks the [Command] key is depressed.

Is there a way I can avoid this situation without relying on changing my habits, which hasn't yet worked out for me after a year of occasionally getting burned by this? :)

I'm thinking the a good approach would be something running under OS X that watches for the [Command] key being depressed for several seconds, and forcibly "unsticks" it.  Such a gimmick wouldn't create any problems for my workflow, but I don't know of a way to accomplish it.
Best solution I've found is to click the blank space in the menu bar, and often.  The left Alt key is mapped to command on my Mac from this PC, and I'll Alt-tab in windows or in my viewer and the Alt key sticks, so all clicks are Command-clicks in the Mac.  So I quite often just Alt-click the menu bar to clear that stuck key.