I believe your camera enters power saving mode (different from auto shutdown) in which it disables the LCD and the sensor. Motion detector obviously won't have an input image to work with when the sensor is shut down. Thsi is easily fixed.
Set CHDK menu -> miscellaneous -> disable LCD off: alt (or script)
to make CHDK prevent this power saving mode. The reason you can't shoot in this mode is probably because you didn't remember you are in CHDK ALT mode while running this script... to verify, you can of course press alt to pause the script and then attempt to shoot (or full press shutter to interrupt the script, then press ALT to exit ALT mode and then shoot).