fix(file): handle creation with file (refs #4479)

Test if the doc is an memory and store instead of save