Stock market closes with a stumble ahead of looming tariffs