Tidy up error handling in WriteExpression
Optimized the HtmlEncode so that it does not create the char[] unless it is going to split the string up. Saving memory/cycles on strings that need no encoding.