Investors & landlords

"in  some cases."

 

If your loss is denied because you previously bought M shares, then yes you would have to close out the M shares also before year-end.

 

If you are a trader, it all works out in the end and your broker does the hard work of keeping track of it all.