Generally, there isn't way to detect when the Canon firmware is fully done saving a shot.
You can use the very hacky hack ckdhptp does for shoot and and download: Figure out the file path from image number and directory, and wait for it to stop growing.
That's in 'wait_file' around line 1122
https://app.assembla.com/spaces/chdkptp/subversion/source/HEAD/trunk/lua/rlibs.lua?_format=raw&disposition=inline but it's mixed in with some other cruft.
The image file name should be some thing like
img=string.format('%s/IMG_%04d.JPG',get_image_dir(),get_exp_count())
You'll obviously want to wait for exp_count to update before you do that
For cameras with Canon raw support, you'll also want to use get_canon_image_format() to figure out if the extension should be JPG or CR2. If both raw and jpeg are enabled, you should be able to just wait for the jpeg.
Looks like I neglected to add get_canon_image_format to scripting docs. It return a bitmask with bit 1 set if canon jpeg is enabled, and bit 2 set if raw is enabled.