[#858] Removed unused variables
[#2212] CID37524, CID37517, CID37504, and CID37496:

closed the null file descriptors