US stocks close out January with gains