os.remove removes the file. Some parts of the Canon firmware may not notice that it has been removed until you restart the camera.
If you have another file with the same number (for example a raw, or a voice note) the camera may still show something like a missing image icon even though the jpeg is gone.
The post you got those files from was posted in 2008. That functionality has been included in CHDK for a long time. The diff file is a patch for the source code, which won't do anything on your SD card. The test script functionality is now in llibtst.lua, which is included in the standard CHDK distribution.