createHTMLDocument: Check title argument for undefined

Obviously it's ok to just call 'toString()' on null, false, {} etc. as <title> values.