diff --git a/bcbio/bam/fasta.py b/bcbio/bam/fasta.py
index <HASH>..<HASH> 100644
--- a/bcbio/bam/fasta.py
+++ b/bcbio/bam/fasta.py
@@ -4,8 +4,14 @@ def sequence_length(fasta):
     """
     return a dict of the lengths of sequences in a fasta file
     """
-    file_handle = open(fasta)
-    in_handle = SeqIO.parse(file_handle, "fasta")
-    records = {record.id: len(record) for record in in_handle}
-    file_handle.close()
+    sequences = SeqIO.parse(fasta, "fasta")
+    records = {record.id: len(record) for record in sequences}
+    return records
+
+def sequence_names(fasta):
+    """
+    return a list of the sequence IDs in a FASTA file
+    """
+    sequences = SeqIO.parse(fasta, "fasta")
+    records = [record.id for record in sequences]
     return records
Add function to get list of sequence names from a FASTA file.

Refactor to be simpler.