avoid error when user cancel "Save as" prompt
fix redirect after save a file + tiny changes

1 - fix redirect after save a new file
2 - added native recursive directory creator
3 - added default extension according to pagetype
Merge pull request #7 from horphoz/master

fix redirect after save a file + tiny changes