Revert to the previous selection in the file tree if there's an error.

Fix for #9313.

cc @ingorichter