Fixed error in closing an empty pool