Try to cleanly close connection instead of calling connectionLost directly.