I have this weird problem whenever I connect my macbook pro to an external monitor. I'm running Windows 10 Pro. The problem occurs only when I close the laptop's lid. The mouse starts acting up, it applies clicks randomly. Perhaps even stranger is that it stops doing it after 5 to 10 minutes. On the other hand, if the lid is open and I work on both screens, then it acts normally.

Do you have any idea where to start from if I want to troubleshooting this problem?