Thanks Norm for the suggestion.

In the end I found out that the path I thought I was writing to was a relativa path from my home dir, instead of absolute.

I discovered this by changing the path...