Should create dirs to file before attempting to write it