I have two systems running Mavericks. One is my MacPro which I did a clean install and upgrade to Mavericks then migrated user data from Time Machine backup. Mail App has worked flawlessly on this system.
My second system was a 2012 15 MBP with Retina on which I followed the same proceedure I outlined above. Mail fails to quit, sync properly and is generally flakey all around.
In December 2013 I replaced this MBP with a new late 2013 15 MBP with Retina. This system came with Mavericks factory install. I used the data migration assistant and restored from Time Machine backup and the problem persists.
I have since tried all of the suggestions in this thread.. some work once then mail returns to its bad behavior. I have also deleted all mail accounts, .pref files and such and set them back up from scratch, restoring all data from the mail servers. STILL mail refuses to quit or sync properly.....
My account types (configured exactly the same on both working install of Mavericks and the problem child)
1) iCloud (legacy .Mac account)
2) Hosted Exchange from Rackspace
3) Hosted Excange from Inbox Solutions