Closing Macbook lid changes external screen to primary
Again, another stab at the dark here:
Either:
(Easy route) remove the monitor's cable from the computer/ or manually put it to sleep OR
open up your terminal and write the command
'pmset -g'
it will display your current power management settings.
from then on you could try disabling lidwake, acwake or messing around with the gpu switch option(though, honestly i think its only related to either enforcing dedicated or external/separate internal gpu settings ).
Also, try disabling the darkwake option.(which is not listed within pmset's man pages but you can google your way thru understanding it)
pmset -c darkwake 0

Note: all pmset values require sudo access