[Redmine #3905] Make safe_open() treat trailing slashes like open().