Bug fix to CRAM indexing and index usage.

Containers/slices with sequences for multiple references in them
(container ref_seq_id -2) were not being correct indexed nor queried.
bcf_write: sanity check the number of samples, resolves #55
Fixed two small memory leaks.
Revert one of the previous memory leaks as it breaks multi-threading.
I need to find a more suitable way to solve this. The memory leak is
back, but it's tiny; essentially leaking the last (empty) container.
Better fix for container memory leak.

Now passes valgrind in threaded and non-threaded mode.
Return "" from bam_flag2str(0) rather than NULL

This produces better results when used in a printf.
Merge CRAM indexing bug fixes (PR #85)

(Merged via cherry-picking, and fixed typo in the most recent commit.)