It's not that you can't mine, just that no bitcoins are going to be created from mining. If miners stopped mining (which they will most probably do if they stop making money from it), it would mean the death of the blockchain. No mining means no transaction.
Currently, miners make money from two sources:
- Bitcoins created for each mined block
- Transaction fees paid for each transaction, that the miner is free to assign to wallet (guess who they will choose)
Transaction fees are just the fact that, if you pay me bitcoins, you'll have to pay a little more that is assigned to nobody. Miners will grab the pending transaction that they want to include in their mined blocks (those that pay the best, look at Fee statistics) given that a block can contain a limited amount of data, and keep the money for them.
To conclude, in 2140, if the network goes well, transaction fees should be enough for miners to earn their gigawatts. If not, then we will worry