Refactoring: restructure open_file to remove duplicated code.
Also add comments and reduce the scope of th WX_PURE block.
Authored by: david_costanzo 2019-05-27
Parent: [r4928]
Child: [r4930]