Write protect directories as well

If this works (still testing), this should fix https://github.com/hashdist/python-hpcmp2/issues/55.