diff --git a/pyfasta/records.py b/pyfasta/records.py index f352b1e..8f6f2b1 100644 --- a/pyfasta/records.py +++ b/pyfasta/records.py @@ -85,9 +85,8 @@ def copy_inplace(klass, flat_name, fasta_name): os.rename(flat_name, fasta_name) # still need the flattend file to show # it's current. - flatfh = open(fasta_name + klass.ext, 'w') - flatfh.write(MAGIC) - flatfh.close() + with open(fasta_name + klass.ext, 'w') as flatfh: + flatfh.write(MAGIC)