Update app.js

add exit callback