Wastewater treatment for production of H2S-free biogas