Added checks on successful writing of slices, plus generic function checkSave to handle printed output