def close(self):
    '\n        Finalizes the state of the camera.\n\n        After successfully constructing a :class:`PiCamera` object, you should\n        ensure you call the :meth:`close` method once you are finished with the\n        camera (e.g. in the ``finally`` section of a ``try..finally`` block).\n        This method stops all recording and preview activities and releases all\n        resources associated with the camera; this is necessary to prevent GPU\n        memory leaks.\n        '
    for port in list(self._encoders):
        self.stop_recording(splitter_port=port)
    assert (not self.recording)
    for overlay in list(self._overlays):
        self.remove_overlay(overlay)
    if self._preview:
        self._preview.close()
        self._preview = None
    if self._splitter:
        self._splitter.close()
        self._splitter = None
    if self._camera:
        self._camera.close()
        self._camera = None
    (exc, self._camera_exception) = (self._camera_exception, None)
    if exc:
        raise exc
Finalizes the state of the camera.

After successfully constructing a :class:`PiCamera` object, you should
ensure you call the :meth:`close` method once you are finished with the
camera (e.g. in the ``finally`` section of a ``try..finally`` block).
This method stops all recording and preview activities and releases all
resources associated with the camera; this is necessary to prevent GPU
memory leaks.
def close(self):
    '\n        Finalizes the state of the camera.\n\n        After successfully constructing a :class:`PiCamera` object, you should\n        ensure you call the :meth:`close` method once you are finished with the\n        camera (e.g. in the ``finally`` section of a ``try..finally`` block).\n        This method stops all recording and preview activities and releases all\n        resources associated with the camera; this is necessary to prevent GPU\n        memory leaks.\n        '
    for port in list(self._encoders):
        self.stop_recording(splitter_port=port)
    assert (not self.recording)
    for overlay in list(self._overlays):
        self.remove_overlay(overlay)
    if self._preview:
        self._preview.close()
        self._preview = None
    if self._splitter:
        self._splitter.close()
        self._splitter = None
    if self._camera:
        self._camera.close()
        self._camera = None
    (exc, self._camera_exception) = (self._camera_exception, None)
    if exc:
        raise exc