                     
                     // It's done close the channel
                     // TODO: Maybe don't close if you want half-open channel
-                    dispatch_io_close(self.channel, 0)
+                    // NOTE: This will be done by onCompleted or onError
+                    // dispatch_io_close(readChannel, 0)
                 }
             }
             return AnonymousDisposable { [fd = self.fd] in
                 log.verbose("Disposing \(fd) for reading.")
-                dispatch_io_close(self.channel, 0)
+                dispatch_io_close(readChannel, 0)
             }
         }
     }

                }
                
                // Schedule write operation
                dispatch_io_write(self.channel, off_t(), dispatchData, dispatch_get_main_queue()) { done, data, error in
                    
                    if error != 0 {
                        // If there was an error emit the error.

                        } else {
                            // Must be an unrecoverable error, close the channel.
                            // TODO: Maybe don't close if you want half-open channel
                            // NOTE: This will be done by onCompleted or onError
                            // dispatch_io_close(self.channel, 0)
                        }
                    }
                }
            }
            return AnonymousDisposable { [fd = self.fd] in
                log.verbose("Disposing \(fd) for writing.")
                dispatch_io_close(writeChannel, 0)
            }
        }
    }
