American Woodmark swings to a profit