add file error checks

Signed-off-by: James Pearman <jbpearman@mac.com>