diff --git a/screed/openscreed.py b/screed/openscreed.py index cd11db2..bd32d46 100644 --- a/screed/openscreed.py +++ b/screed/openscreed.py @@ -76,6 +76,7 @@ def open_reader(self, filename, *args, **kwargs): try: first_char = peek[0] except IndexError as err: + sequencefile.close() return [] # empty file try: @@ -89,6 +90,7 @@ def open_reader(self, filename, *args, **kwargs): iter_fn = fastq_iter if iter_fn is None: + sequencefile.close() raise ValueError("unknown file format for '%s'" % filename) self.sequencefile = sequencefile