Add with-file-modes macro, and use it