It was trying to rm -f a similar but different filename, which left an executable hanging around after the test.