Pass test exit code through while still performing cleanup tasks.  Fix bash syntax bug.