Fixed early client.close() issue