Well now, the PC shuts off when you command it to, and it takes some time to do so, neatly closing processes and open disk files.
It should be possible to arrange a process which is called promptly on the command to close down and sends a signal to the USB serial port to which the Arduino is connected.