title: RuntimeError: Event loop is closed - Telegram
body: <p>I'm trying to run a telegram client using the async module like in the <a href="https://media.readthedocs.org/pdf/telethon/latest/telethon.pdf" rel="nofollow noreferrer">documentation</a> on page 15</p>
  
  <pre><code>import telethon
  from telethon import TelegramClient, events
  import asyncio
  
  client = TelegramClient(USERNAME, API_ID, API_HASH)
  
  async def main():
      await client.start()
  
  if __name__ == '__main__':
      loop = asyncio.new_event_loop()
      asyncio.set_event_loop(loop)
      loop = asyncio.get_event_loop()
      loop.run_until_complete(main())
  </code></pre>
  
  <p>When trying to run <code>await client.start()</code> I get the following error. </p>
  
  <pre><code>Task was destroyed but it is pending!
  task: &lt;Task pending coro=&lt;MTProtoSender._send_loop() running at 
  /home/myuser/.local/lib/python3.5/site-packages/telethon/network/mtprotosender.py:347&gt; wait_for=&lt;Future pending cb=[Task._wakeup()]&gt;&gt;
  Task was destroyed but it is pending!
  task: &lt;Task pending coro=&lt;MTProtoSender._recv_loop() running at /home/myuser/.local/lib/python3.5/site-packages/telethon/network/mtprotosender.py:411&gt; wait_for=&lt;Future pending cb=[Task._wakeup()]&gt;&gt;
  Exception ignored in: &lt;coroutine object MTProtoSender._send_loop at 0x7f27c688b468&gt;
  Traceback (most recent call last):
    File "/home/myuser/.local/lib/python3.5/site-packages/telethon/network/mtprotosender.py", line 347, in _send_loop
    File "/home/myuser/.local/lib/python3.5/site-packages/telethon/network/mtprotosender.py", line 720, in get
    File "/usr/lib/python3.5/asyncio/queues.py", line 170, in get
    File "/usr/lib/python3.5/asyncio/futures.py", line 227, in cancel
    File "/usr/lib/python3.5/asyncio/futures.py", line 242, in _schedule_callbacks
    File "/usr/lib/python3.5/asyncio/base_events.py", line 497, in call_soon
    File "/usr/lib/python3.5/asyncio/base_events.py", line 506, in _call_soon
    File "/usr/lib/python3.5/asyncio/base_events.py", line 334, in _check_closed
  RuntimeError: Event loop is closed
  Task was destroyed but it is pending!
  task: &lt;Task pending coro=&lt;UpdateMethods._update_loop() running at /home/myuser/.local/lib/python3.5/site-packages/telethon/client/updates.py:206&gt; wait_for=&lt;Future pending cb=[Task._wakeup()]&gt;&gt;
  </code></pre>
  
  <p>Is there any way of fixing this without going into the module code or am I doing something wrong with asyncio?</p>