CR changes: moved binding to beforeClose event to events object