cleanup and error handling for lecture editor