show all failure in phpunit tests
close previous file if opening a new one

minor optimization
remvoe BOM only on 1st line

fix coding style