US stock market bounces back to close with gain