'closed' event function is fired multiple