Matthew weakens to post-tropical storm as it batters the US