Handle recordshell hanging after exit, still to fix FileDescriptor error
Better error handling, the error is very opaque otherwise!