Added check on inputs and boolean check to fgetcsv
Edited handle assignments

Fixed bug when reading and writing
Testing code