Environmental consultancy APEM seals third takeover deal and secures £25m refinancing