Switch to set -e.

Also adding a delete_files function
to protect dangerous file deletions.