Judge James E. Boasberg said top officials, including the defense secretary, the national security adviser and the secretary of state, must preserve the messages they exchanged.