This bug/error only happens when in combat (mostly hand-to-hand melee combat).
Example: Zombie sees me and starts running to me. I select a weapon (or not) and press and hold RMB to engage the weapon. Then I press LMB to do a strike. And then almost always the game minimizes to desktop so I have to click on the icon to get back to the game. Meanwhile I get damaged/hit resulting in bleeding and so on. This happens with NPC and human controled characters.
But! I cannot reproduce this while not in combat! So lets say I'm alone somewhere and I do exactly the same things the game won't minimize.