simplified error handling from write_notebook