Extract file writing method