We have code to set a document as current. Also it seems this is not restored afterwards.