Cleanup split memleaks

Clean up a couple of memory leaks in samtools split relating to strings,
state and opts.

Signed-off-by: Martin O. Pollard <mp15@sanger.ac.uk>
Use kstring instead of POSIX 2008's strndup()

Also write free(str.s) directly and use ks_release() where appropriate.
Merge split cleanups (PR #210)