Use safe file open method