Address issues #242, #192

Instead of opening gallery files in init methods, defer until read/write are first called. This avoids the need to open in r/w mode, which caused a number of problems (such as #242, #192), as well as general oddness such as requiring w permissions when it shouldn't really be necessary.