Add check exists before unlink and refactor

Header & Footer file now only removed when option is not null and file exists.

Fixes:
when option['header-html'] or option['footer-html'] is null then
unlink(): No such file or directory
thrown on generate.