The reason for this is connected to opportunity cost. As the value of the land the motel is on goes up, the opportunity cost (and the implicit cost) of operating the motel goes up. This means that the economic profit that can be made by operating the motel goes down.
When the land is cheap, the opportunity cost of running the motel is low and it stays in business. When the cost of the land increases, there are other, more profitable things that can be done with the land than running a motel on it. Therefore, the motel closes and is sold to someone who can make more money using the land.