SCP: Fix log and debug file reference count management.
SCP: Avoid redundant log and debug output