[core] Move I/O decorators to Core.

Plus, catch all OSError/IOError instead of only perm ones.