Closing writers and readers at the end