Added saving of CoreData context and error message. fixes #1