bam_merge tests: fix warnings

Fix warnings caused by not checking return value of freopen and getline.