Fix bug in --list operation due to concurrent i/o on input.

This also cleans up the termination of the read thread for those
cases where the entire input was not read, but the read thread is
no longer needed.
1 file changed