@Override
    public void removeTable(final String tableName) throws IOException {
        checkName(tableName);
        String fullPath = tableDir + File.separator + tableName;

        File file = new File(fullPath);
        if (!file.exists()) {
            throw new IllegalStateException("Table not exist already!");
        }
        writeLock.lock();
        try {
            if (!tableInUse.containsKey(tableName)) {
                DataBase base = new DataBase(tableName, this, null);
                base.drop();
            } else {
                tableInUse.get(tableName).drop();
                tableInUse.remove(tableName);
            }
            if (!file.delete()) {
                throw new DataBaseException("Cannot delete a file " + tableName);
            }
        } finally {
            writeLock.unlock();
        }
    }