Avoid returning from a finally clause.

It is a bad practice to return from a finally clause, in which case
unhandled exceptions will be lost.

Cherry-picked from commit 5905cf9 of the switch branch.

Signed-off-by: Min Chen <minchnew@gmail.com>
Fixed a bug where flows won't be sorted properly.

Signed-off-by: Min Chen <minchnew@gmail.com>