Fix invalid use of open()