Files are now properly opened.
Removed counter I added for testing
Removed counter, as it is not needed
Fixed issue where file descriptor limit could be hit