Cli hangs when the server goes away

Presto cli hangs for a long time when the server goes away. Add a check to see if the client is closed so that we can get out of this state by sending SIGINT