fixed a bug that would cause an exception to be thrown if the program
tries to save a tree state when it has no write permissions