add utils.path.ensure_dir_exists

Ensures that a directory exists,
and protects against a common race condition when multiple
processes try to create the same directory.
better error message when path exists but is not dir
change default dir permissions to 755

777 is a weird default