ensure that doc is saved before attempting completions