Sales rise, losses narrow at Ply Gem