Unplug the magsafe power adapter first, then remove the cord from the macbook the macbook will operate just fine. However, the x will remain.
open