Fix memory correctness

Read after free
Read the SAM header (required when using HTSlib on SAM)
Change return codes from HTS functions
Updated to handle new sequence identifiers