Check for NULL-pointer arguments and add bool return value which indicates whether any of the file operations failed.