changed the semantics of close() for dual_use filters: close() is now called just once, with the value of the which parameter determined by the mode of the associated chain