utils: simplify flopen()
utils: simplify flopen() usage

Make flopen context manager that automatically unlocks file on __exit__
(if fcntl is supported by the platform)
fileserver: move stuff oout of critical section
Merge pull request #10441 from SaveTheRbtz/flopen

flopen improvements