Bugfix. Input.pending() returned None if the port was closed. Now 0.