alternate way to attach server close handler