added closing behavior