Fix injection where there is stuff on the same line as </head>

Our HTML happens to contain a closing tag before `</head>` on the same line as it. Livereload injects the script and then writes out the whole line, so the script ends up inside another tag. My fix is very simple: it writes the line containing `</head>` in parts.