Bump version to 1.0.4-beta2. Fix bug when closing endpoint