Null intent fix, close file descriptors properly.