/// <summary> /// Closes the stream. After this call the stream will not be valid /// </summary> public void Close(Action <UvArgs> callback = null) { if (this.Status != FileStatus.Open) { throw new InvalidOperationException(String.Format("Cannot close the file handle while the status is {0}", this.Status)); } IntPtr req = IntPtr.Zero; try { req = this.CreateRequest(); CheckError(Uvi.uv_fs_close(this.Loop.Handle, req, _file, _closeDelegate)); this.Status = FileStatus.Closing; _closeCallback = new UvCallback(this, callback); } catch (Exception) { this.FreeRequest(req); throw; } }