Buffer OS X read_raw() for faster loading

Also add attach() and detach() to read_raw() and write_raw() and remove
trailing whitespace on a function.