Clear selection, context and rename for deleted files.

Fix for #9214.

cc @ingorichter 
@dangoor Out of curiosity, do we know why this is needed?  I would think the earlier call to FileSyncManager would have already changed the current document to something else if the selected item has been removed...  Wouldn't the tree be synced up with that state already?