queue pop method, tail should set the next node to null