Close graphics dev in finally clause

closes #4408 (already closed)