Fixed write_tail/3, was not working properly for empty lists
Minor bug fix in ref_replace:term_write_stop_nl, sometimes the tail is not a []
Fixed do_r_goal_expansion/2, prolog_load_context/2 does not work properly in such place, using refactor_file context variable instead.
Fixed rename_predicate, was not working properly