Removing app.js before writing to it to avoid partial writes

Fixes #128
Merge branch 'hotfix-1.0.1'