Do not crash when connection is closed