Ensuring that reader is closed after being read

Thanks to @pquerna for pointing this out