issues dealing with open file

In unit_test/ directory, creating file functions has no error check. Adding error check here.