Added excetion handling in case or error flushing