[test runner] Fix unreliable closing over m in failure function