onClose should not be global.
Merge pull request #25 from gcirne/fix-global-onclose

onClose should not be global.