Williams agrees to terms with Titans