# Buggy code
def _GetStatus(self):
    """Returns status information.

    Returns:
      dict[str, object]: status attributes, indexed by name.
    """
    if self._parser_mediator:
        number_of_produced_errors = self._parser_mediator.number_of_produced_errors
        number_of_produced_events = self._parser_mediator.number_of_produced_events
        number_of_produced_sources = (
            self._parser_mediator.number_of_produced_event_sources
        )
    else:
        number_of_produced_errors = None
        number_of_produced_events = None
        number_of_produced_sources = None

    if self._extraction_worker:
        last_activity_timestamp = self._extraction_worker.last_activity_timestamp
        processing_status = self._extraction_worker.processing_status
    else:
        last_activity_timestamp = 0.0
        processing_status = self._status

    task_identifier = ""
    if self._task:
        task_identifier = self._task.identifier

    status = {
        "display_name": self._current_display_name,
        "identifier": self._name,
        "number_of_consumed_errors": None,
        "number_of_consumed_events": self._number_of_consumed_events,
        "number_of_consumed_sources": self._number_of_consumed_sources,
        "number_of_produced_errors": number_of_produced_errors,
        "number_of_produced_events": number_of_produced_events,
        "number_of_produced_sources": number_of_produced_sources,
        "last_activity_timestamp": last_activity_timestamp,
        "processing_status": processing_status,
        "task_identifier": task_identifier,
    }

    return status


# Traceback (WindowsError)
(plaso) C:\dev\plaso>python tools\psort.py -o xlsx G:\test_data\set_1_output.zip -w G:\test_data\set_1_output.xlsx --status_view none -d --analysis browser_search
2016-08-30 12:37:21,882 [INFO] (MainProcess) PID:9376 <psort> Starting analysis plugins.
2016-08-30 12:37:21,888 [DEBUG] (MainProcess) PID:9376 <zeromq_queue> Creating socket for browser_search output event queue
2016-08-30 12:37:21,898 [DEBUG] (MainProcess) PID:9376 <zeromq_queue> browser_search output event queue bound to random port 61649
2016-08-30 12:37:22,417 [INFO] (MainProcess) PID:9376 <psort> Started analysis plugin: browser_search (PID: 14200).
2016-08-30 12:37:24,822 [INFO] (MainProcess) PID:9376 <psort> Analysis plugins running
Traceback (most recent call last):
File "tools\psort.py", line 867, in <module>
if not Main():
File "tools\psort.py", line 853, in Main
tool.ProcessStorage()
File "tools\psort.py", line 787, in ProcessStorage
status_update_callback=status_update_callback)
File "C:\dev\plaso\plaso\frontend\psort.py", line 103, in AnalyzeEvents
status_update_callback=status_update_callback)
File "C:\dev\plaso\plaso\multi_processing\psort.py", line 536, in AnalyzeEvents
storage_writer.Open()
File "C:\dev\plaso\plaso\storage\zip_file.py", line 3217, in Open
self._storage_file.Open(path=self._output_file, read_only=False)
File "C:\dev\plaso\plaso\storage\zip_file.py", line 2754, in Open
self._OpenZIPFile(path, read_only)
File "C:\dev\plaso\plaso\storage\zip_file.py", line 1740, in _OpenZIPFile
os.rename(path, zipfile_path)
WindowsError: [Error 32] The process cannot access the file because it is being used by another process

# Fixed code
def _GetStatus(self):
    """Returns status information.

    Returns:
      dict[str, object]: status attributes, indexed by name.
    """
    if self._parser_mediator:
        number_of_produced_errors = self._parser_mediator.number_of_produced_errors
        number_of_produced_events = self._parser_mediator.number_of_produced_events
        number_of_produced_sources = (
            self._parser_mediator.number_of_produced_event_sources
        )
    else:
        number_of_produced_errors = None
        number_of_produced_events = None
        number_of_produced_sources = None

    if self._extraction_worker:
        last_activity_timestamp = self._extraction_worker.last_activity_timestamp
        processing_status = self._extraction_worker.processing_status
    else:
        last_activity_timestamp = 0.0
        processing_status = self._status

    task_identifier = getattr(self._task, "identifier", "")

    status = {
        "display_name": self._current_display_name,
        "identifier": self._name,
        "number_of_consumed_errors": None,
        "number_of_consumed_events": self._number_of_consumed_events,
        "number_of_consumed_sources": self._number_of_consumed_sources,
        "number_of_produced_errors": number_of_produced_errors,
        "number_of_produced_events": number_of_produced_events,
        "number_of_produced_sources": number_of_produced_sources,
        "last_activity_timestamp": last_activity_timestamp,
        "processing_status": processing_status,
        "task_identifier": task_identifier,
    }

    return status