Check for error on file close