Remove multiple open() calls