Updated to close window after reading.