Add error check around sys_open