Fixes #35: make sure the directory exists before creating error.txt in it