Modern WebKit browsers don't necessarily fire the unload event at the moment where the page is hidden. This is done in order to allow improved caching.
You might consider replacing the use of unload with the pagehide event.
See this blog post for an in-depth discussion.