There are many thousands who make a considerable profit with the law as is. The vast majority of units in fact. Those who knowingly loose money by closing a profitable business out of resentment for their customers should not be in that business anyway.
At any rate, there are people that could enter say, the medical field or restaurant business if regulations are relaxed.
The difference is there are not thousands of restaurants siting empty because the owner can't profit under the current regulations or refuses to on principle or out of petulance. And just as they would quite properly go bankrupt, so too must the owners of un-rented units, presumably selling to those that know how to run them.
No one is forced to be in a particular industry and if one person can't profit in the same circumstances that thousands other do, then rather than blaming the government or voters or the tenants the don't have, they need to take responsibility for the own inability. Barring that, the best policy is taxation and fines on those who refuse to rent going to subsidize those who do.
Likewise those who consider every tenant to be an imminent tenant-squatter are neither temperamentally nor clear minded enough to run a rental business. And, far from getting sympathy, are likely to be resented. Which is probably not going to help. I imagine Barcelona's policy is going to become pretty wide spread.