The cancel you do in the BeforeUpdate event of the form, only cancels that event - the saving of the record, which is called from your "Close" macro, then it continues to try to close the form...
So, what you need, is for the "Close" thingie not to continue, if the form is dirty... Now this can...