Coset Coding to Extend the Lifetime of Non-Volatile Memory