What It Means
To square off a position is to close it by taking the opposite trade — selling what you bought, or buying back what you sold short — bringing your exposure in that stock back to zero.
How It Works
You can square off voluntarily whenever you choose to exit. It can also happen without your input: a broker forces a square-off when a margin call goes unmet, and intraday positions that aren't manually closed get auto-squared-off by the broker's system shortly before market close, since intraday trades can't carry into the next session.
Warning
An auto square-off near market close doesn't wait for a good price — it executes at whatever's available in the last few minutes of trading, which can be worse than if you'd closed the position yourself earlier.