Added proper handles to file access.