No person shall be convicted of an offense under this chapter for possessing any firearms, weapons, destructive devices, silencers or explosives, if after giving written notice of his intention to do so, including the proposed date and time of surrender, he voluntarily surrendered the weapon, device, instrument or substance in question to the superintendent or to the chief of police in the municipality in which he resides, provided that the required notice is received by the superintendent or chief of police before any charges have been made or complaints filed against such person for the unlawful possession of the weapon, device, instrument or substance in question and before any investigation has been commenced by any law enforcement agency concerning the unlawful possession. Nothing in this section shall be construed as granting immunity from prosecution for any crime or offense except that of the unlawful possession of such weapons, devices, instruments or substances surrendered as herein provided.