added copyright message, fixed closing stderr bug