Enhanced open

This PR changes the `open` method to use `io.open` (note that in Python 3 the latter is just an alias for the `open` built-in function). All methods that used the `open` built-in function directly have been changed to use `Path.open` instead, so that a subclass only has to override one method to implement a customized open.

In addition, newline patterns have been moved to module-level variables, and regular expression matching is used for removal and replacement. This makes related code more efficient, compact and easier to maintain.
Oops, I hadn't notice you already merged this