The reason a firm stays open if price is above AVC but below ATC is because the firm is losing LESS money by staying open than it is by closing down. If they can charge more than AVC, they can pay all their variable costs and still have a bit to put towards their fixed costs. If they shut down, they still have to pay all the fixed costs.
BUT: the second part of your question brings up something very important.
The above answer ONLY applies in the short term. If a firm finds that it is not going to be able to do anything to get prices above ATC, it should, in the long term, shut down. In the long term it can get rid of its fixed costs by doing something like selling its machinery and buildings.