more bugfixes for NEP

some issues came up during stress testing. As an added bonus, file no
descriptor will be now cached