Move darwin/safari.close() to base.js, and listen close event.