write chosen entry to primary terminal and close window