fix incorrect handling of multiple pending takes when closing