DebugToFile was crashing on extern stages

Fixes #344
Merge branch 'master' of github.com:halide/Halide