What happened

Shares of Redfin (RDFN -3.38%) were tumbling today after the company said it would lay off 13% of its workforce, or 862 people, and shutter its iBuying (instant buying) division, RedfinNow. That follows a similar move by rival Zillow a year ago.

As a result, the stock finished the day down 12%.

So what

Ahead of the company's third-quarter earnings report after hours today, CEO Glenn Kelman emailed the company to tell them it was closing the home-flipping business, telling staff that the business wasn't worth the risk in an environment with rising interest rates and falling home prices across much of the country.

The company had previously laid off 8% of its staff in June. 

The news isn't particularly surprising after Zillow closed its home-flipping unit, and iBuyer Opendoor has reported massive losses. Redfin, which regularly releases housing market forecasts, expects the housing market to contract next year as mortgage rates are likely to remain elevated, according to the Federal Reserve's guidance.

Now what

After hours, the company released Q3 earnings that were more or less in-line with analyst estimates. Revenue rose 11% to $600.5 million, slightly below estimates at $602.8 million, and its loss per share widened from $0.20 to $0.83, which compared to expectations of a loss of $0.80 per share.

Excluding the RedfinNow business, revenue in the quarter was essentially flat at $300 million, though gross profit declined sharply, showing the core business, as an online real estate brokerage and listings platform, is struggling as well.

Management called for a 29% to 33% decline in Q4 as it winds down RedfinNow, and reported another round of wide losses. The stock was down another 3% in after-hours trading and is now down more than 95% from its peak early last year.

With the real estate market continuing to weaken, any recovery in Redfin stock will take time if it comes.