FoBoT: I believe that from a .bat file, removing the .lock file is the ONLY way to kill the client without losing data. I don't think it will close correctly with a signal (not even sure it listens for signals).
However, this has worked for me 100%. Loop on existence of the progress.txt file. When the client stops, progress.txt disappears.
PS. I think that's how dfGUI knows when the client has stopped.
PPS. Make sure that the client is running first, or you could wait a VERY long time!