Refactor unify code to make it easier to get at record unification
Fix #825, nicer error messages when accessing missing fields

By figuring out if a record is open or closed, we can throw the error
earlier so we have more information in the message
Merge branch 'record-unification'