Home Depot swings to Q4 profit