A pub in Wales has been saved from closure after Hollywood actor Matthew Rhys backed a campaign to help locals buy the business.