Add test for gref writing
Fix broken attempts to open r+ non existant files