Added load_submasks kwarg to write segments