added better error messages for samtools sort and index