Fix endpoint close