basepak.sh: fix .pk3 optimisation and script termination.