Steps to reproduce:
- Summon a villager and give him a job.
- Build a command block setup so you can summon lightning on the villager (with delay so you have time to open his trading GUI).
- Activate the setup.
- Open the GUI.
- After the villager has been converted to a witch, the trading GUI stays open and you can actively trade in it.