Sept 6 (Reuters) - NextGen Healthcare on Wednesday said it has agreed to be bought by private equity firm Thoma Bravo for about $1.61 billion. (Reporting by Bhanvi Satija in Bengaluru; Editing by Dhanya Ann Thoppil)