Submitted by 0xRajeev
Orderbook.removeBids() as commented:
removeOldBids() is performed currently in Market.newRental() and Treasury.deposit() to  do some cleaning up, it might help cancel their foreclosure as commented. However, this is missing in the withdrawDeposit() function where the need is the most because user is removing deposit which may lead to foreclosure and is even commented as being useful on L356.
The impact is that, if we do not remove closed market bids during withdrawDeposit, the closed market bids still get accounted in users bidRate in the conditional on L357 and therefore do not prevent the foreclosure in withdrawDeposit that may happen in L357-L367. User may get foreclosed because of mis-accounted closed-market bids in the order book.
Recommend adding call to removeOldBids() on L355 of withdrawDeposit() of Treasury.
Splidge (Reality Cards) confirmed but disagreed with severity and then resolved:
