asyncio: Add Transport.is_closing()

See https://github.com/python/asyncio/pull/291 for details.
diff --git a/Lib/asyncio/base_subprocess.py b/Lib/asyncio/base_subprocess.py
index 6851cd2..73425d9 100644
--- a/Lib/asyncio/base_subprocess.py
+++ b/Lib/asyncio/base_subprocess.py
@@ -87,6 +87,9 @@
     def _start(self, args, shell, stdin, stdout, stderr, bufsize, **kwargs):
         raise NotImplementedError
 
+    def is_closing(self):
+        return self._closed
+
     def close(self):
         if self._closed:
             return
diff --git a/Lib/asyncio/proactor_events.py b/Lib/asyncio/proactor_events.py
index abe4c12..9c514c8 100644
--- a/Lib/asyncio/proactor_events.py
+++ b/Lib/asyncio/proactor_events.py
@@ -65,6 +65,9 @@
     def _set_extra(self, sock):
         self._extra['pipe'] = sock
 
+    def is_closing(self):
+        return self._closing
+
     def close(self):
         if self._closing:
             return
diff --git a/Lib/asyncio/selector_events.py b/Lib/asyncio/selector_events.py
index 0060912..236f7b3 100644
--- a/Lib/asyncio/selector_events.py
+++ b/Lib/asyncio/selector_events.py
@@ -556,6 +556,9 @@
     def abort(self):
         self._force_close(None)
 
+    def is_closing(self):
+        return self._closing
+
     def close(self):
         if self._closing:
             return
diff --git a/Lib/asyncio/sslproto.py b/Lib/asyncio/sslproto.py
index 9e08b6f..dde980b 100644
--- a/Lib/asyncio/sslproto.py
+++ b/Lib/asyncio/sslproto.py
@@ -304,6 +304,9 @@
         """Get optional transport information."""
         return self._ssl_protocol._get_extra_info(name, default)
 
+    def is_closing(self):
+        return self._closed
+
     def close(self):
         """Close the transport.
 
diff --git a/Lib/asyncio/streams.py b/Lib/asyncio/streams.py
index 64d1020..6b5e96a 100644
--- a/Lib/asyncio/streams.py
+++ b/Lib/asyncio/streams.py
@@ -302,7 +302,7 @@
             if exc is not None:
                 raise exc
         if self._transport is not None:
-            if self._transport._closing:
+            if self._transport.is_closing():
                 # Yield to the event loop so connection_lost() may be
                 # called.  Without this, _drain_helper() would return
                 # immediately, and code that calls
diff --git a/Lib/asyncio/transports.py b/Lib/asyncio/transports.py
index 03099e3..9a6d919 100644
--- a/Lib/asyncio/transports.py
+++ b/Lib/asyncio/transports.py
@@ -19,6 +19,10 @@
         """Get optional transport information."""
         return self._extra.get(name, default)
 
+    def is_closing(self):
+        """Return True if the transport is closing or closed."""
+        raise NotImplementedError
+
     def close(self):
         """Close the transport.
 
diff --git a/Lib/asyncio/unix_events.py b/Lib/asyncio/unix_events.py
index bf3b084..f75e89f 100644
--- a/Lib/asyncio/unix_events.py
+++ b/Lib/asyncio/unix_events.py
@@ -364,6 +364,9 @@
     def resume_reading(self):
         self._loop.add_reader(self._fileno, self._read_ready)
 
+    def is_closing(self):
+        return self._closing
+
     def close(self):
         if not self._closing:
             self._close(None)
@@ -548,6 +551,9 @@
             self._loop.remove_reader(self._fileno)
             self._loop.call_soon(self._call_connection_lost, None)
 
+    def is_closing(self):
+        return self._closing
+
     def close(self):
         if self._pipe is not None and not self._closing:
             # write_eof is all what we needed to close the write pipe