scripts/mosh: Fix hang when remote closes the connection

Signed-off-by: Anders Kaseorg <andersk@mit.edu>