added closing event handlers