we had exactly same problem with other  break board brand ,they work very hard and update the plugin and the firmware
seems communication  mach3 and 4 not same, and i think you waste yours time solve it
its not at yours hand ,press yours supplier solve it or replace hardware
now after the upgrade pokeys very  very stable(i use 8 relay cards in my machine  ,mean 64 outputs) 
and before have exactly same situation as you describe(its very very dangerous ,tool can release while working)