exception handeling IO

add catch for file IO exceptions