write snapshot