Fix: unload record with relationships

- calling `clearRelationships` before changing record state,
  otherwise it fails, because properties try to update removed
  relationships

- Transaction commit failed when an unloaded record was in the
  `transaction.bucketForType.updated` array. Using recordIsMoving fixed
  this issue
Merge pull request #567 from ppcano/unload-fix

Fix: unload record with relationships