Run unload method before pushing the new state

If running unload causes any hash changes, those should not end up on the new
URL.

Fixes #622