writing ser file