XD-1938: Prevent shell crash in completion

It's exactly for that reason (long running shell with an XD server for example) that we'd enter the catch block. Previously, this would make the shell process crash