Modified to allow the connection closing even when calling coroutines