Can I always sell before a market ends?
Usually — as long as there are buyers on the order book.
You can sell whenever there are buyers on the order book, which is almost always true for active markets. In quiet markets, or just before a result, the price you get can be far from the last price — the panel shows what you will receive before you confirm. Trading stops when a market closes.