removed extra menubar call
added error handling to readFile and writeFile