Ensuring that reader is closed after being read