closed reader and writer