df.style.render() not producing valid html
#### Code Sample, a copy-pastable example if possible

Code is copied from [Styling](https://pandas.pydata.org/pandas-docs/stable/style.html).

```python
np.random.seed(24)
df = pd.DataFrame({'A': np.linspace(1, 10, 10)})
df = pd.concat([df, pd.DataFrame(np.random.randn(10, 4), columns=list('BCDE'))], axis=1)
df.iloc[0, 2] = np.nan
df.style.render().split('\n')[:20]
```
#### Problem description

The problem is that the produced string is not even valid html, closing tags are missing, there are blank lines etc...

```
['',
 '        <style  type="text/css" >',
 '        ',
 '        ',
 '        </style>',
 '',
 '        <table id="T_49b86528_f4b9_11e8_9b2f_34e6d70c57d8" None>',
 '        ',
 '',
 '        <thead>',
 '            ',
 '            <tr>',
 '                ',
 '                <th class="blank">',
 '                ',
 '                <th class="col_heading level0 col0">A',
 '                ',
 '                <th class="col_heading level0 col1">B',
 '                ',
 '                <th class="col_heading level0 col2">C']
```

#### Expected Output

Something like this:

```
['<style  type="text/css" >',
 '    #T_4c0fa58e_98a7_11e8_9d82_ff3af6a67056row0_col2 {',
 '            background-color:  red;',
 '        }</style>  ',
 '<table id="T_4c0fa58e_98a7_11e8_9d82_ff3af6a67056" > ',
 '<thead>    <tr> ',
 '        <th class="blank level0" ></th> ',
 '        <th class="col_heading level0 col0" >A</th> ',
 '        <th class="col_heading level0 col1" >B</th> ',
 '        <th class="col_heading level0 col2" >C</th> ']
```



#### Output of ``pd.show_versions()``

```
INSTALLED VERSIONS
------------------
commit: None
python: 3.5.2.final.0
python-bits: 64
OS: Linux
OS-release: 4.4.0-137-generic
machine: x86_64
processor: x86_64
byteorder: little
LC_ALL: None
LANG: en_US.UTF-8

pandas: 0.17.1
nose: None
pip: 18.1
setuptools: 35.0.2
Cython: None
numpy: 1.15.4
scipy: 1.1.0
statsmodels: 0.8.0
IPython: 7.1.1
sphinx: 1.8.1
patsy: 0.5.0
dateutil: 2.7.5
pytz: 2018.7
blosc: None
bottleneck: None
tables: 3.2.2
numexpr: 2.4.3
matplotlib: 3.0.2
openpyxl: None
xlrd: None
xlwt: None
xlsxwriter: 0.7.3
lxml: None
bs4: None
html5lib: 1.0.1
httplib2: 0.9.1
apiclient: None
sqlalchemy: None
pymysql: None
psycopg2: None
Jinja2: None
```
Just note `jinja2` is installed:

<details>
import jinja2
jinja2.__version__
'2.10'
</details>
