Usually , the larva pupates in a cocoon within the mine .
Sometimes the larva leaves the mine and lives freely for a while before pupating externally .
Usually , the larva pupates in a cocoon within the mine , but sometimes the larva leaves the mine and lives freely for a while before pupating externally .