build.sh: fix the cleanup logic.