main.c: account for possible failure and save failing page to html file