They paid X billion dollars for an asset (Nokia's devices unit). The asset was recorded as being worth X billion dollars on Microsoft's balance sheet (this is called "goodwill" -- the value is what they paid, not an objective assessment).
When they shut down the unit, that asset obviously ceased to have any value, and all the goodwill that was on the balance sheet materialised as a loss. But in fact the money had been paid out years earlier (when the acquisition completed), so at this point the loss was only on paper.
It's sort of like if you pay $400 for an Apple Watch assuming you'll be using it all the time to improve your health. Two years later, you still haven't gone to the gym and you find the watch collecting dust in a drawer, so you must admit to yourself that the device was not an investment and your $400 were lost.
https://www.forbes.com/sites/rodadams/2017/02/14/toshiba-cha...