Safely checking for codeMirror when unmounting