Fixes OSError deprecation warning.