Cosmetic changes in main editor script
Fixes #244 - Empty HTML file when closing