doc: Use 'close' rather than 'exit' in spawn examples

Close #4515