Avoid race-condition on directory creation.