Add file modes to `__all__`, switch on safe_file tests, improve mode x handling and fix shabang