util.c checks return value of file ops

Added code to util.c that checks whether a file could be opened. The functions now fail gracefully if that is not the case. The program now doesn't crash anymore when opened from the wrong working directory where textures and shaders cannot be found.