Wouldn't it be better to try to figure out the service that takes care of X and shut it down? I mean, killing Xorg may not work on init systems such as systemd, that will try to automagically restart them anyway...