Nearly £4m of work to help improve water quality and protect the environment at the River Arun has been completed.