Safely handle syntax errors in scripts
Add a few more cleanup cases in page dispose