asyncio.subprocess: Fix a race condition in communicate()

Use self._loop instead of self._transport._loop, because transport._loop is set
to None at process exit.
asyncio: Fix _ProactorWritePipeTransport._pipe_closed()

The "exc" variable was not defined, pass a BrokenPipeError exception instead.
asyncio: remove unused imports and unused variables noticed by pyflakes