Preserve selections and scroll position on saving file