Fixed bug if output directory does not exist. Exit if bam files cannot be read or written.