closing file after reading it and counting time on running script