Fix ConnectionClosedException for newer nodejs version