split reader.go into 2 files; add closeReader/closeWriter