client.gets returns nil when connection is closed