A liquid state theory that remains successful in the critical region