Simplify requestSlots filling
Extract method closeFile
Streamline error handling and locking