This might help:
Step 1: Install Nvu
Step 2: Open up the HTML file within Nvu, which will fix up your code (add all the brackets, closing tags, etc.)
Step 3: Save the changes to your code.
If this doesn't help, let me know.
http://www.nvu.com/index.php