Electromagnet stays energized after being switched off
You actually have a Darlington transistor with internal resistors rather than the BJT that you show. 

I will assume that your solenoid draws quite a bit of current. You need much more than a 100nF capacitor across the transistor to absorb the energy. You have probably damaged the transistor (or possibly the capacitor). 

When the Darlington turns off, the inductance will try to maintain the same current flowing, and the voltage at the Darlington collector will rise to make that happen. If the solenoid current is substantial, hundreds of mA or more, the capacitor will have little effect and the voltage will rise, probably to over 100V, causing the transistor (or possibly the capacitor) to break down. With enough energy that will kill the transistor. If the capacitor breaks down it has failed and probably short. 

You can leave the capacitor on there, it does control the EMI and is not high enough value to cause problems for the transistor, but you must add a flyback diode across the coil (or something similar). 



If you want the solenoid to drop out faster, you can add a resistor in series with the diode. The voltage across the coil will rise to a maximum of I*R +Vf where I is the operating current of the solenoid and Vf is the diode forward voltage. So if the solenoid draws 500mA and you want to allow the collector voltage to rise to 30V you can allow the (coil + diode) voltage to rise to 17V so R should be less than 34\$\Omega\$.