onerror does not trigger onclose for ws always