Added event as parameter to on_close function, fixes #15