US stock market closes lower, posting weekly decline