Add offline mode

Check for `error` and return `error` if exist incase of problem writing to the filesystem.