Make sure page load is completed before saving

- Make sure page load is completed before saving
- Optional header and footer
- setSuppressesIncrementalRendering
- Fix memory managment issues