Exception handling with opening files, and update makefile