sort imports before saving rewrite

Fixes #114.