fix bug with simultaneous read and write in NiftiIO, some cleanup and removal of compatibility code