better path checking when attempting to write the config

Signed-off-by: Alfredo Deza <alfredo.deza@inktank.com>
Merge pull request #107 from alfredodeza/6580

better path checking when attempting to write the config