Clear closed flag when opening connection

It might still be set from the previous connection.

See https://gist.github.com/MMcM/a383f94d3ecbf267cb42 for a way to reproduce the problem.